20140714 creating thumbnails at the command line - plembo/onemoretech GitHub Wiki

title: Creating thumbnails at the command line link: https://onemoretech.wordpress.com/2014/07/14/creating-thumbnails-at-the-command-line/ author: phil2nc description: post_id: 8010 created: 2014/07/14 16:51:52 created_gmt: 2014/07/14 20:51:52 comment_status: closed post_name: creating-thumbnails-at-the-command-line status: publish post_type: post

Creating thumbnails at the command line

Really simple stupid using the ImageMagick package, as long as you have a real command line to work with. First make sure ImageMagick is installed.

yum install ImageMagick

Then figure out how big you want your thumbnails to be. In my case, nominally 80px by 80px from (very roughly) 350px by 350px originals. Use the convert utility to generate your thumbnails.

convert -thumbnail 80 somepic.jpg somethumb.jpg

The lone "80" refers to 80px in width, allowing the util to adjust height dynamically. In my real situation many of the images were somewhat longer in height than wide (for example, 350x466px), making for a slightly longer thumbnail (in the case of a 350x466px original resulting in a 80x107px thumbnail). The convert utility has lots of other options for manipulating images, and the ImageMagick collection it is part of has many more utilities along the same lines. For those who want to go beyond the shell, there are ImageMagick APIs for perl (via the Image::Magick module), python, php and other scripting languages.

Copyright 2004-2019 Phil Lembo