Possible BUG cropping GIF files

MagickWand for PHP is an object-oriented PHP interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning MagickWand for PHP.
Post Reply
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Post by el_supremo » 2006-08-05T16:40:02-07:00

I think I've found the solution to this problem.
After MagickCropImage add:

MagickSetImageExtent($mgck_wnd, $w, $h)

where $w,$h are the dimensions used in the crop.

The GIF header specifies a width and height of a logical screen on which the image(s) in the file will be displayed and this logical screen size isn't altered when you crop an image. Setting the imageextent forces it to change.

Best Wishes
Pete

User avatar
magick
Site Admin
Posts: 11077
Joined: 2003-05-31T11:32:55-07:00

Post by magick » 2006-08-05T17:07:54-07:00

Use MagickSetImagePage() and set the offsets to 0. This resets the virtual canvas. Although MagickSetImageExtent() may work, MagickSetImagePage() is better suited to reset the virtual canvas.

el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Post by el_supremo » 2006-08-05T21:57:34-07:00

I was using Rexx when I was doing the testing so I don't know if those two functions are implemented in PHP but both are definitely in MagickWand. MagickSetImagePage is documented here:
http://studio.imagemagick.org/api/magic ... tImagePage

Pete

Post Reply