IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
when you crop the image and output it as PNG and GIF, you get different results. PNG has the correct crop width and height, GIF still keeps the original canvas size, but shifts the cropped image.
Note that crop is done from (20, 0) in the example
This seems to happening mainly with GIF images and I am not fully sure why it happens. It has something to do with virtual canvas on GIFs. On the other hand the virtual canvas might be something that someone might want to use so it would not be polite to call MagickSetImagePage automatically during crop/resize.
Can you please elaborate a bit on the reply? It seems this problem only happens when I do the crop and set the output to gif. Do you mean that by calling setPage on other formats like jpg and png, there will be side effects to the virtual canvas? I think the virtual canvas will be resized after the crop anyways, not true?