Zoom, offset, crop

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
bajram
Posts: 2
Joined: 2015-04-30T22:27:38-07:00
Authentication code: 6789

Zoom, offset, crop

Post 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
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Zoom, offset, crop

Post 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.
bajram
Posts: 2
Joined: 2015-04-30T22:27:38-07:00
Authentication code: 6789

Re: Zoom, offset, crop

Post 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
Post Reply