Resize and Crop in one Step ?

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
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Resize and Crop in one Step ?

Post by glennrp » 2006-04-01T21:28:30-07:00

stijink wrote: Hi,

I'm fiddling around with convert for a while now. So i just give it a try in this forum :)

My input image can be in landscape format or in panel format. (up to 1000x1000 pixels) Now i want to create a quadratic Thumbnail out of it. With one command-line-call if possible. My output size should be 70x70 pixels.

I found out:

I can crop 70x70 pixels out of the middle of the picture using the following options:

-gravity Center -crop 70x70+0+0

A fellow programmer used the following options to generate a "smaller" Version (Thumbnail) of an image with the correct ratio:

-geometry "120x90>"

Is there a way to combine those options to have an resized and cropped image in 70x70 pixels as a result ?

Many thanks,
Stephan

Try this:

Code: Select all

convert input.png -gravity Center -crop 350x350+0+0 -resize 70x70 +repage output.png
That's still two steps but both within one invocation of "convert".

Glenn

Post Reply