php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64898 imagerotate is broken
Submitted: 2013-05-22 10:43 UTC Modified: 2013-05-28 09:33 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: douglas dot wright at pre-school dot org dot uk Assigned: pajoye (profile)
Status: Closed Package: GD related
PHP Version: 5.5.0RC1 OS: Windows 7
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: douglas dot wright at pre-school dot org dot uk
New email:
PHP Version: OS:

 

 [2013-05-22 10:43 UTC] douglas dot wright at pre-school dot org dot uk
Description:
------------
When attempting to rotate an image using PHP5.5RC1, the output is corrupted. This is a regression from latest stable PHP 5.4

Test script:
---------------
<?php

$source = imagecreatefrompng('original.png');
$rotate = imagerotate($source, 45, imagecolorallocate($source,255,255,255));
imagepng($rotate, 'rotated.png');

Expected result:
----------------
Please see comparison screenshot at http://tinypic.com/r/34t8qdu/5 

Actual result:
--------------
Please see comparison screenshot at http://tinypic.com/r/34t8qdu/5 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-05-22 12:46 UTC] pajoye@php.net
-Status: Open +Status: Feedback
 [2013-05-22 12:46 UTC] pajoye@php.net
Do you have the original image please? You can use tinypic too but I need the 
original images.
 [2013-05-22 12:54 UTC] douglas dot wright at pre-school dot org dot uk
-Status: Feedback +Status: Open
 [2013-05-22 12:54 UTC] douglas dot wright at pre-school dot org dot uk
Sure, the one I used in the testcase is https://www.pre-school.org.uk/publicationimage/236/thumbnail/?size=200
 [2013-05-26 23:37 UTC] pajoye@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: pajoye
 [2013-05-26 23:49 UTC] pajoye@php.net
Reproduced. Have to figure out what went wrong lately with the bilinear 
interpolation and the rotate function.

As a work around, add:

imagesetinterpolation($source, IMG_BICUBIC_FIXED); // or any prefered algorithm

before the imagerotate call.
 [2013-05-27 07:22 UTC] pajoye@php.net
Automatic comment on behalf of pierre.php@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=2f01e06786c6f4b2479fdb728bd26062d07208e0
Log: fix #64898imagerotate is broken with bilinear interpolation
 [2013-05-27 07:23 UTC] pajoye@php.net
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2013-05-27 07:23 UTC] pajoye@php.net
-Status: Assigned +Status: Closed
 [2013-05-28 09:33 UTC] douglas dot wright at pre-school dot org dot uk
Fix confirmed. Many thanks.
 [2013-11-17 09:31 UTC] laruence@php.net
Automatic comment on behalf of pierre.php@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=2f01e06786c6f4b2479fdb728bd26062d07208e0
Log: fix #64898imagerotate is broken with bilinear interpolation
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 02 10:01:28 2025 UTC