php-imagine / Imagine

PHP Object Oriented image manipulation library
https://imagine.readthedocs.io
Other
4.42k stars 529 forks source link

rotate() inconsistencies between drivers #709

Closed ninze closed 3 years ago

ninze commented 5 years ago

Issue description

Gd and Imagick drivers leave the image in a different state after rotation.

What version of Imagine are you using?

1.2.1-dev

What's the PHP version you are using?

PHP 7.2.1

What's the imaging library you are using [gd/imagick/gmagick/any]?

Imagick, Gd

Minimal PHP code to reproduce the error:


$size = $image->getSize();
$image->rotate(45);
$image->crop(new Point(0, 0), $size);

Output by Gd driver: Gd-output

Output by Imagick driver: Imagick-output

The problem is that Imagick does not update image geometry after the rotation. I think a similar issue is described here: https://phpimagick.com/Tutorial/imageGeometryReset

Output from Gd seems to be the correct one.

The solution would be to call setImagePage() inside Imagick driver after the rotation.

mlocati commented 3 years ago

Fixed by #734