php5-gd imagecolorset no longer working properly after upgrade to 9.04

Bug #368036 reported by Keith Hughitt
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
php
Unknown
Unknown
php5 (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: php5

I wrote a small piece of code using that uses the php5-gd module. The script takes a grayscale PNG and modifies it's index to use 256-color lookup table then outputs it as an 8-bit JPEG image, or 8-bit paletted PNG. Since upgrading Ubuntu from 8.10 to 9.04, however, the script only outputs grayscale images, with no error message.

Outputting the results from imagecolorsforindex shows that the script is still reading the palette properly, so it must have something to do with the next step (imagecolorset).

Any ideas?

I've attached some example images used in the script below, as well as the resulting image from before and after the upgrade.

$gd = imagecreatefrompng("eit_grayscale.png");
$ctable = imagecreatefrompng("ctable_eit304.png");

for ($i = 0; $i <= 255; $i++) {
 $rgba = imagecolorsforindex($ctable, $i);
 imagecolorset($gd, $i, $rgba["red"], $rgba["green"], $rgba["blue"]);
}

imagejpeg($gd, "eit_final.jpg", 75);
imagedestroy($gd);
imagedestroy($ctable);

Revision history for this message
Keith Hughitt (keith-hughitt) wrote :
Revision history for this message
Keith Hughitt (keith-hughitt) wrote :
Revision history for this message
Keith Hughitt (keith-hughitt) wrote :
Revision history for this message
Keith Hughitt (keith-hughitt) wrote :
Revision history for this message
Keith Hughitt (keith-hughitt) wrote :

Update: Bug also found to exist in other systems (tested Fedora 11 Beta).

Reported upstream: http://bugs.php.net/bug.php?id=48123

Revision history for this message
Andreas Olsson (andol) wrote :

Tried your example on both a fresh Ubuntu 8.10 and a fresh Ubuntu 9.04. In both cases I actually ended up with the a grey scaled result.

Not so sure if this is an upstream issue, considering that both Ubuntu 8.10 and Ubuntu 9.04 uses the same upstream version of PHP.

Changed in php5 (Ubuntu):
status: New → Incomplete
Andreas Olsson (andol)
Changed in php5 (Ubuntu):
status: Incomplete → New
Revision history for this message
Chuck Short (zulcss) wrote :

Hi,

I was wondering if you could reproducing this bug with the Karmic version.

Thanks
chuck

Changed in php5 (Ubuntu):
status: New → Incomplete
Revision history for this message
Keith Hughitt (keith-hughitt) wrote :

Hi Chuck,

Thanks for following up. Actually it turns out that the issue was not really caused by a bug, but rather an increased strictness in newer versions of GD. (See upstream thread: http://bugs.php.net/bug.php?id=48123).

Overall though everything works really well in Karmic.

Revision history for this message
Ondřej Surý (ondrej) wrote :

Bug invalid per comment #8

Changed in php5 (Ubuntu):
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.