Skip to content

Instantly share code, notes, and snippets.

@mbostock
Last active Jun 16, 2019
Embed
What would you like to do?
Creating Thumbnails with GraphicsMagick
license: gpl-3.0

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

#/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
@johan
Copy link

johan commented Jan 28, 2013

How do you typically produce the source images for a bl.ocks.org gist? Viewing /d/gist_id full screen and saving a screenshot with Cmd+Shift+4? Some hack involving transloadit.com, some phantomjs hack, or something else?

@joyrexus
Copy link

joyrexus commented Apr 16, 2014

@johan good question! Would love to know how to streamline thumbnail creation and use in conjunction with gistup. This would be a great tip to add to the Let's Make a Block tutorial.

Note, some additional tips for semi-manually rightsizing your PNGs can be found on this d3.unconf HOWTO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment