Skip to content

Instantly share code, notes, and snippets.

@joyrexus
Forked from mbostock/.block
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joyrexus/11226097 to your computer and use it in GitHub Desktop.
Save joyrexus/11226097 to your computer and use it in GitHub Desktop.
Convert images to thumbnails

Finds PNG images in the source folder, and saves corresponding thumbnails to the target folder.

Use with gistup to create gists (and blocks) from the command line. The directory containing your gist files gets initialized as a git repo. See this tutorial for a quick overview.

For additional tips on generating block thumbnails, see this HOWTO.

#/bin/bash
pushd source
sources=(*.png)
for i in "${sources[@]}"; do
echo "Converting $i"
gm convert \
-crop 1920x1000+312+510 \
-resize 230x120 \
"$i" \
"../target/$i"
done
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment