diff --git a/README.md b/README.md index 6e11f11..7db43b5 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,11 @@ Get a clone: git clone --recursive https://github.com/est31/leaftest.git ``` +Compile the downscaler: +``` +(cd downscaling && sh compile.sh) +``` + To start the mapping, do: ``` MAPPERDIR=dir/containing/minetestmapper ./mapper.sh path/to/world spawnx,spawny dimension diff --git a/mapper.sh b/mapper.sh index aebde0a..70dade2 100755 --- a/mapper.sh +++ b/mapper.sh @@ -16,6 +16,19 @@ if [ ! -f $mapperpath ]; then exit 1 fi +if [ -f downscaling/perc ]; then + echo "Using SSIM based downscaling" + downscale() { + downscaling/perc 2 < $1 > ${1}_small + mv -f ${1}_small $1 + } +else + echo "Using downscaling provided by imagemagick" + downscale() { + convert $1 -resize 50% $1 + } +fi + if [ -z "$JOBNUM" ]; then JOBNUM=1 fi @@ -111,7 +124,7 @@ do echo "montage exited with non zero exit code, aborting." exit 1 fi - convert $dir/map_${x}_${y}.png -resize 50% $dir/map_${x}_${y}.png \ + downscale $dir/map_${x}_${y}.png \ 2> >(>&2 prefix "[SHRINK $zlv/map_${x}_${y}.png ERR]: ") | prefix "[SHRINK $zlv/map_${x}_${y}.png]: " if [ ${PIPESTATUS[0]} -ne 0 ]; then echo "shrinking exited with non zero exit code, aborting."