I'm trying to create thumbnails of JPG photos using ImageMagick's convert tool. The thumbnails need to have a defined size (210x159), no blank areas, and the image can be cropped if necessary.

Unfortunately, I only have ImageMagick 6.3.7 available, which doesn't support the '^' geometry modifier (added in v6.3.8-3). Is there another way to achieve this in earlier versions of ImageMagick?


I found a description of how to simulate '^' with older ImageMagic versions. It's not perfect, because the original will be resized 2-3 times, which obviously has the potential to add artifacts and blurring, but it appears to solve the problem.

convert logo: \
        -resize x160 -resize '160x<'   -resize 50% \
        -gravity center  -crop 80x80+0+0 +repage  space_fill.jpg

Here's a rather thorough description of what exactly this does:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.