Skip to content

Instantly share code, notes, and snippets.

@mfd
Last active March 20, 2018 18:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mfd/c0118ac5e195a482bcb17a75cf9bd0c5 to your computer and use it in GitHub Desktop.
Save mfd/c0118ac5e195a482bcb17a75cf9bd0c5 to your computer and use it in GitHub Desktop.
ImageMagick sprite image snippets

imagemagick sprite

convert $(ls *.png | sort -r) +append res/result-sprite-vertical.png
convert $(ls *.png) -append res/result-sprite-horizontal.png
convert *png *gif -append PNG8:res/result-sprite-horizon.png

imagemagick Montage #

montage *.png -background transparent -geometry +4+4  res/sprite.png
montage $(ls *.png -t) -mode Concatenate -tile 2x16+1+1 -border 2 res/sprite.png
montage $(ls *.{png,jpg} -tr) -mode Concatenate -tile 2x50+1+1 -border 2 _"${PWD##*/}".jpg
montage $(ls *.{png,jpg} -tr) -mode Concatenate -tile 3x50+1+1 -border 2 _"${PWD##*/}".jpg

multirenaming

ls | cat -n | while read n f; do echo "$f -> " `printf "%03d.png" $n`; done
# sort by time & reverse | 
ls *.png -tr | cat -n | while read n f; do cp "$f" `printf "pics/%03d__$f" $n`; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment