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

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
hankr

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

Post 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 );
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

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

Post by magick »

After you crop, try adding MagickResetImagePage() to reset the virtual canvas.
hankr

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

Post 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?
Post Reply