Page 1 of 1

MagickCropImage

Posted: 2013-02-18T12:10:59-07:00
by 168gr
Am I misunderstanding this function?

I have an image, 1024 x 576 and I'm trying to crop a 400 x 300 area out of the top left.

Code: Select all

fprintf( stderr, "Before crop, image is %d x %d\n", MagickGetImageWidth( temp_mw ), MagickGetImageHeight( temp_mw ) );
MagickCropImage( temp_mw, 400, 300, 0, 0);
fprintf( stderr, "After crop, image is %d x %d\n", MagickGetImageWidth( temp_mw ), MagickGetImageHeight( temp_mw ) );
I'm not getting what I expect though:

Code: Select all

Before crop, image is 1024 x 576
After crop, image is 400 x 204
I don't understand why the cropped image height is 204 instead of 300.

Re: MagickCropImage

Posted: 2013-02-22T00:04:59-07:00
by 168gr
No ideas, eh? I'll try to extract and post some more details. Something ain't right, surely my code, but I can't for the life of me figure out what it is.

Re: MagickCropImage

Posted: 2013-04-04T18:53:05-07:00
by anthony
That should not happen... UNLESS the input image has a virtual canvas offset!!!!

See...Crop an image with existing page geometry
http://www.imagemagick.org/Usage/crop/#crop_page

I think you have been missing the equivalent of +repage