Page 1 of 1

Zoom, offset, crop

Posted: 2015-04-30T22:35:45-07:00
by bajram
Hi,

I found ImageMagick very helpful on manipulating with images. However, I'm trying to accomplish the following result for days now and it seams that I'm still not understanding what is going on!

What I want to achieve is:
Get an image (gif, jpg or png) of a give dimension, ex.: 377x250px, zoom it to 427x238px, than move X & Y pixels from left and top, and then crop it to exactly 180x180px without stretching it.

Here is the illustration of it
Image

Any help from your will really be appreciated.

Thanks,

Bajram

Re: Zoom, offset, crop

Posted: 2015-04-30T23:44:19-07:00
by Bonzo
Have you checked out the -crop instructions: http://www.imagemagick.org/script/comma ... s.php#crop

You set the size you want first and then set the offset.

Re: Zoom, offset, crop

Posted: 2015-05-01T03:36:02-07:00
by bajram
Hi,

I found the solution, here it is:

Resize the image to the new size, crop it with specified x/y offset and then rebuild it completely as an image

Code: Select all

/usr/local/bin/convert from.gif  -resize 427x238 -crop 180x180+124+67 +repage  to.gif
Thanks