Skip to content

Instantly share code, notes, and snippets.

@yfujiki
Created May 1, 2014 19:56
Show Gist options
  • Save yfujiki/e87881be611931f1d6c9 to your computer and use it in GitHub Desktop.
Save yfujiki/e87881be611931f1d6c9 to your computer and use it in GitHub Desktop.
Create tile images of 256x256, zooming 100%, 50% and 25%
#!/bin/bash
file=$1
function tile() {
convert $file -scale ${s}%x -crop 256x256 \
-set filename:tile "%[fx:page.x/256]_%[fx:page.y/256]" \
+repage +adjoin "${file%.*}_${s}_%[filename:tile].${file#*.}"
}
s=100
tile
s=50
tile
s=25
tile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment