Skip to content

Instantly share code, notes, and snippets.

@sanderversluys
Created November 16, 2014 22:05
Show Gist options
  • Save sanderversluys/9659efc826f07795c3f8 to your computer and use it in GitHub Desktop.
Save sanderversluys/9659efc826f07795c3f8 to your computer and use it in GitHub Desktop.
Split image in tiles with ImageMagick
#!/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