Create thumbnails and a HTML page for listing them (with links to sources)

mogrify -format gif -auto-orient -thumbnail 250x90 '*.JPG'&&(echo "<ul>";for i in *.gif;do basename=$(echo $i|rev|cut -d. -f2-|rev);echo "<li style='display:inline-block'><a href='$basename.JPG'><img src='$basename.gif'></a>";done;echo "</ul>")>list.html
The input images are assume to have the "JPG" extension. Mogrify will overwrite any gif images with the same name! Will not work with names with spaces.
Sample Output
<ul><li><a href='001_9440846553_ohm20131.JPG'><img src='001_9440846553_ohm20131.gif'></a><!-- ... -->

By: ysangkok
2013-08-25 20:45:49

What Others Think

You should close your and tags. mogrify -format gif -define jpeg:size=500x180 -auto-orient -thumbnail 250x90 '*.jpg' && (echo "<ul>"; for i in *.gif; do basename=$(echo $i | rev | cut -d. -f2- | rev) ; echo "<li><a href='$basename.jpg'><img src='$basename.gif'></a></li>"; done; echo "</ul>") > list.html
lowjax · 362 weeks and 4 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: