Page 1 of 1

crop doesn't work

Posted: 2014-04-15T19:06:10-07:00
by qvisto
Hi there,

I am trying to resize and rotate a part of an image and then crop it to a smaller size.

This command worked perfectly fine with ImageMagick 6.2.8:
convert $1 -crop 1280x800+0+0 -region 1280x800+0+8 -resize 960x600 -crop 960x600+0+0 -region 960x600+0+8 -rotate 2.5 -resize 118% -roll -26-92 $1
The result was a jpg with 960x600px

On a second machine with ImageMagick 6.5.4-7 the result is an image with 1280x800px. I also tried +repage after crop - without success.

What's the missing piece? Any help is appreciated.

Ralf

Re: crop doesn't work

Posted: 2014-04-15T19:16:48-07:00
by anthony
Why are you using -region with -crop?

That combination of operations does not make a lot of sense!

-region is essentually a 'temporary crop' with the results compsed back onto the original image on the next -region command, or a end of region (+region) operation.

That is the final image size will be restored after a set of region operations is finished!

See Region and Sub-Region Images
http://www.imagemagick.org/Usage/masking/#regions

Re: crop doesn't work

Posted: 2014-04-15T19:20:50-07:00
by qvisto
I'm using region because of a 8px border on the top of the image which must stay intact.

Re: crop doesn't work

Posted: 2014-04-15T19:28:22-07:00
by qvisto
Using +region results in

convert: wand/mogrify.c:8067: SyncImageSettings: Assertion `image->signature == 0xabacadabUL' failed.

:-(

Re: crop doesn't work

Posted: 2014-04-15T20:21:34-07:00
by qvisto
Updated to ImageMagick-6.8.9-0 and +region works now.

Re: crop doesn't work

Posted: 2014-04-15T21:08:35-07:00
by anthony
did that solve your problem?

Another thing that may be giving issues is is that -region is essentually a 'saved original, and crop' operation. However the page offset from the crop is not removed, though it is also not used when the region image is composed back onto the original (saved) image. However that offset can effect a operation like crop that is appied to the regon image, unless you took that into account, or removed the offset using +repage after using -region.

See notes at the Region Example Link given previously.