Page 1 of 1

JPG -> Crop -> PDF is all white, and uncropped size.

Posted: 2010-04-02T23:02:50-07:00
by hankr
When opening a large image, cropping the left half of it, and saving as a 300 dpi PDF, things have gone wonky since 6.4.0
The following code is rock solid on 6.4.0, however, I rebuilt 6.5.3 and 6.6.0, and the output image is all white and the width is the full size of the image as though it was never cropped, even though MagickGetImageWidth/Height give what appear to be correct values after MagickCropImage call. Doing nothing but reverting IM 6.4.0 the output is perfect.

Ideas?

Code: Select all

$imageWand = NewMagickWand();
MagickCropImage( $imageWand, round( ($point_width) * COVER_REZ ), round( MagickGetImageHeight( $imageWand ) ), round( MagickGetImageWidth( $imageWand ) - ($point_width * COVER_REZ) ), 0 );
MagickResizeImage( $imageWand, (1026*COVER_REZ), (846*COVER_REZ), MW_GaussianFilter, .5 );
MagickSetResolution( $imageWand, 300, 300 );
MagickWriteImage( $imageWand, $tempFile );
DestroyMagickWand( $imageWand );

Re: JPG -> Crop -> PDF is all white, and uncropped size.

Posted: 2010-04-03T06:37:43-07:00
by magick
After you crop, try adding MagickResetImagePage() to reset the virtual canvas.

Re: JPG -> Crop -> PDF is all white, and uncropped size.

Posted: 2010-04-03T14:15:05-07:00
by hankr
Thanks Magick, that did the trick. Should MagickResetImagePage always be called from now on? Are there any other cases you can think of where it might be needed?