crop doesn't work

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
qvisto
Posts: 4
Joined: 2014-04-15T18:52:24-07:00
Authentication code: 6789

crop doesn't work

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: crop doesn't work

Post 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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
qvisto
Posts: 4
Joined: 2014-04-15T18:52:24-07:00
Authentication code: 6789

Re: crop doesn't work

Post by qvisto »

I'm using region because of a 8px border on the top of the image which must stay intact.
qvisto
Posts: 4
Joined: 2014-04-15T18:52:24-07:00
Authentication code: 6789

Re: crop doesn't work

Post by qvisto »

Using +region results in

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

:-(
qvisto
Posts: 4
Joined: 2014-04-15T18:52:24-07:00
Authentication code: 6789

Re: crop doesn't work

Post by qvisto »

Updated to ImageMagick-6.8.9-0 and +region works now.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: crop doesn't work

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply