Resize after 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
lenz1979
Posts: 2
Joined: 2011-03-10T07:40:01-07:00
Authentication code: 8675308

Resize after crop

Post by lenz1979 »

Hello!

I want to crop a part of an image and after that resize the cropped part of the original image.

i tried the following:

convert -crop 640x269+0+0 -geometry 585

so get 640x269 of the original image and resize to 585 width.

BUT: the resize will be executed before the crop. so it first resizes the original image and than crops the part of the resized.

How can it be achieved to first crop and after the crop resize the cropped part? (within one command if possible)

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

Re: Resize after crop

Post by Bonzo »

This should work:

Code: Select all

convert input -crop 640x269+0+0 +repage -resize x585 +repage output
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Resize after crop

Post by anthony »

Specifically, you should specify your input image FIRST.

Also I do not recommend the use of -geometry for resizing. Use -resize instead, same arguments.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
lenz1979
Posts: 2
Joined: 2011-03-10T07:40:01-07:00
Authentication code: 8675308

Re: Resize after crop

Post by lenz1979 »

many thanks. that worked perfectly. My problem was that i used it within typo3 library and the typo3 lib function produces the convert command in the follwoing order:

convert params INPUT FRAME OURPUT

and with this order it was not possible.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Resize after crop

Post by fmw42 »

Post Reply