Resizing and cropping images

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
GeXus

Resizing and cropping images

Post by GeXus »

Hello,
I am using the following to crop and resize images

Code: Select all

convert image_big.jpg -thumbnail x200 -gravity center -crop 120x160+0+0 +repage -format jpg -quality 91 image_120x160.jpg
This works about 90% of the time, then other times it does not seem to force the size of 120x160... Is there something extra I need to add in for it to force that size?

Thanks!
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Resizing and cropping images

Post by Bonzo »

You have some bits in your code you do not need; try this:

Code: Select all

convert image_big.jpg -thumbnail x200 -crop 120x160+0+0 +repage -quality 91 image_120x160.jpg
You are thumbnailing to 200 high and the width will stay the same ratio. If you are for instance working on a portrate image the width will always be wrong. If you are using a landscape it will be OK.
Post Reply