Skip to content

Instantly share code, notes, and snippets.

@timrach
Created December 21, 2020 13:10
Show Gist options
  • Save timrach/590b75f292f2b67aed53931202fc4043 to your computer and use it in GitHub Desktop.
Save timrach/590b75f292f2b67aed53931202fc4043 to your computer and use it in GitHub Desktop.
ImageMagick Cheat Sheet
#!/bin/bash
# Take a window of 600x600 pixels of each image and slice it into tiles of 200x200 pixels.
# Save the tiles into a folder ./tiles
mkdir ./tiles
for f in *.jpg; do
filename=$(basename -- "$f")
extension="${filename##*.}"
filename="${filename%.*}"
echo "Processing $f file..";
convert $f -gravity center -crop 600x600+0+0 +gravity +repage -crop 200x200 +repage ./tiles/"$filename"_%d.jpg
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment