Page 1 of 1

cropping and centering without repage

Posted: 2010-10-14T07:24:49-07:00
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

Re: cropping and centering without repage

Posted: 2010-10-14T07:31:48-07:00
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?

Re: cropping and centering without repage

Posted: 2010-10-14T19:31:15-07:00
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.

Re: cropping and centering without repage

Posted: 2010-10-14T19:32:57-07:00
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).