cropping and centering without repage

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
pagedev

cropping and centering without repage

Post by pagedev »

Hello

We have an old version of imagemagick on our server ( 5.5.6) that we can't easily update, and would like to use the following command:

/usr/bin/mogrify -resize x200 -resize '200x' -resize 50% -gravity center -crop 100x100+0+0 +repage "/path/to/image.jpg"

However, we get "/usr/bin/mogrify: Unrecognized option (+repage)"

We've tried it without the repage option and the cropping seems to work fine, but this repage option is apparently sometimes required to "remove virtual canvas layering information". I've no idea what that means and haven't been able to find any information to clarify what it does

Is it necessary?

Thanks very much

Regards
Rupert
immortal26

Re: cropping and centering without repage

Post by immortal26 »

Take a look:
http://www.imagemagick.org/Usage/crop/#crop

As you can see, no it's not needed if you are just wanting to crop an image.

Just out of curiosity though, what's up with the three -resizes?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: cropping and centering without repage

Post by anthony »

pagedev wrote:/usr/bin/mogrify -resize x200 -resize '200x' -resize 50% -gravity center -crop 100x100+0+0 +repage "/path/to/image.jpg"
You are in luck. JPG does not understand and thus does not save save virtual-canvas information.

So just save to JPG.

Other with you would need to use "-page +0+0" for things like GIF which does understand page offsets.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: cropping and centering without repage

Post by anthony »

immortal26 wrote:Just out of curiosity though, what's up with the three -resizes?
Ditto! Doing a resize three times creates three times the artifacts (functional errors).
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply