Skip to content

Instantly share code, notes, and snippets.

@Calinou
Last active March 9, 2022 00:54
Show Gist options
  • Save Calinou/a1ac5604c7acc407dbb060682d76e57b to your computer and use it in GitHub Desktop.
Save Calinou/a1ac5604c7acc407dbb060682d76e57b to your computer and use it in GitHub Desktop.
Script to create a map of a Minetest world (then optimize it using oxipng)
#!/bin/bash
set -euo pipefail
MAP_DIR="/home/hugo/.minetest/worlds/calinou"
TEMP_FILE="/tmp/map_calinou.png"
OUTPUT_FILE="/var/www/games.hugo.pro/minetest/map_calinou.png"
echo "Rendering map, this may take a while…"
/usr/local/bin/minetestmapper \
--input "$MAP_DIR" \
--output "$TEMP_FILE" \
--drawscale --drawalpha \
--scalecolor "#eeeeee" --bgcolor "#0e0e0e"
echo "Optimizing image, this may take a while…"
/home/hugo/.cargo/bin/oxipng "$TEMP_FILE"
echo "Moving temporary file to final destination…"
rm -f "$OUTPUT_FILE"
mv "$TEMP_FILE" "$OUTPUT_FILE"
echo "Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment