-
Notifications
You must be signed in to change notification settings - Fork 7.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GD: imagerotate produces inaccurate results #17982
Comments
This is almost certainly an upstream issue, at least if you're using a system libgd. What does PHP info report about this? |
gdGD Support enabled |
Thanks for the feedback! So this would indeed be an upstream issue. Anyhow, while I haven't had a closer look at this particular issue, I presume that it is (at least partially) caused by the fixed integer arithmetic used by |
Should I open this as a new issue on https://github.com/libgd/libgd/issues, add this as a comment on the |
In doubt, file a new ticket against libgd. (However, there may not be any feedback for quite a while.) |
I have posted this upstream to libgd/libgd#955 so I will close off this one. |
Description
The following code:
Resulted in this output:
imageaffine
andimagerotate
5000*sin(1deg) = 87 pixels
5087x5087
which is the expected sizeimageaffine
produces a triangle of 87px high ✔imagerotate
produces a triangle of 73px high ❌ (this implies an actual rotation of ~0.83 degrees)imagerotate
shows substantial clipping, suggesting the image has been scaled up in some way and the edge pixels lost.The image:

Top left of
imageaffine
followed by top left ofimagerotate
:Top right of
imageaffine
showing pixels correctly go into edgeTop right of
imagerotate
showing substantial cropping of pixels along edge.GD Version: 2.3.3
PHP Version
PHP 8.3.8
Operating System
No response
The text was updated successfully, but these errors were encountered: