Skip to content

Instantly share code, notes, and snippets.

@stekan
Created May 20, 2016 03:40
Show Gist options
  • Save stekan/a59930cc5ab43085aa919e3d98bf110e to your computer and use it in GitHub Desktop.
Save stekan/a59930cc5ab43085aa919e3d98bf110e to your computer and use it in GitHub Desktop.
Generate Thumbnail-Index with ImageMagick
#!/bin/bash
> index.html
[ -d thumbs ] || mkdir thumbs
for f in *.png; do
convert $f -strip -thumbnail 200x100 thumbs/$f
done
find -maxdepth 1 -name \*.png -exec echo "<a href=\"{}\"><img src=\"thumbs/{}\" border=\"0\" style=\"margin:10px;border:1px solid #ccc;\"></a>" \; | sort >> index.html
@sahal
Copy link

sahal commented Jun 25, 2024

This is dope and works perfectly. imagemagick, however, does now complain about using the convert command vs magick. Not sure if it'll be phased out though. Just an fyi for anyone using this script in the future:

$ wget https://gist.githubusercontent.com/stekan/a59930cc5ab43085aa919e3d98bf110e/raw/30236c65ed18790f317c95274d56fa78e8e64813/imagemagick-thumbs-index.sh
$ bash imagemagick-thumbs-index.sh
...
WARNING: The convert command is deprecated in IMv7, use "magick"
...

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