Description:
------------
Rotating an image anticlockwise by -90 degrees (clockwise 90 degrees) produces an image that is 1px narrower than you would expect and the left most vertical column of pixels are all black.
However, rotating an image anticlockwise by 270 degrees (also clockwise 90 degrees) produces an image of the correct dimensions and without the line of black pixels.
Test script:
---------------
Source
http://www.jarrodmakin.com/imagerotate.txt
Usable test script
http://www.jarrodmakin.com/imagerotate.php
Expected result:
----------------
Paraphrasing:
Dimensions are A x B
Dimensions of rotation are B x A
Actual result:
--------------
Paraphrasing:
Dimensions are A x B
Dimensions of rotation are B x (A - 1)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports

[2014-03-12 04:34 UTC] phpmpan at mpan dot pl

Confirmed for master snapshot and 5.5.10.
A quick dive into the code suggests `gmImageRotateBilinear` contains code that handles floats inproperly by casting them to `int` (hence truncating) where extracting integer part was probably meant.
Minimal code:
$image = imagerotate(imagecreate(10, 10), -90, 0)
echo imagesy($image), 'x', imagesx($image)
If the source image has size of 1x1, the effects are even worse, as the functions below receive 0 as size.

I agree. I do appear to have reported a duplicate of #65148, the reporter observed that rotations by negative degrees truncated the picture.
I will aim to build up to date php5.4, 5.5 and 5.6 this week and test.