Bug #70102 [Ana->Csd]: imagecreatefromwebm() shifts colors

From: Date: Sun, 19 Jul 2015 20:45:31 +0000
Subject: Bug #70102 [Ana->Csd]: imagecreatefromwebm() shifts colors
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194561@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70102&edit=1

 ID:                 70102
 Updated by:         cmb@php.net
 Reported by:        cmb@php.net
 Summary:            imagecreatefromwebm() shifts colors
-Status:             Analyzed
+Status:             Closed
 Type:               Bug
 Package:            GD related
 Operating System:   *
 PHP Version:        5.6.11
 Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=php-src.git;a=commit;h=a31fe58d8005ff47f8f6ad095dcd4fb3a2f0aae9
Log: Fix #70102: imagecreatefromwebm() shifts colors


Previous Comments:
------------------------------------------------------------------------
[2015-07-19 17:34:52] cmb@php.net

As has been already pointed out in the upstream ticket, this is
because libgd uses ARGB internally, but the colors are set as
RGBA.

------------------------------------------------------------------------
[2015-07-19 17:32:45] cmb@php.net

Description:
------------
When reading images with imagecreatefromwebp() all colors are
shifted.

This issue has already been reported upstream against libgd:
<https://github.com/libgd/libgd/issues/83>.

Test script:
---------------
<?php
$im = imagecreatetruecolor(8, 8);
$white = imagecolorallocate($im, 0xff, 0xaa, 0x55);
echo sprintf("%08x\n", $white);
imagefilledrectangle($im, 0, 0, 74, 74, $white);
imagewebp($im, 'test.webp');
imagedestroy($im);

$im = imagecreatefromwebp('test.webp');
echo sprintf("%08x\n", imagecolorat($im, 4, 4));
imagepng($im, 'test.png');
?>


Expected result:
----------------
00ffaa55
00ffaa55

Actual result:
--------------
00ffaa55
ffab5500


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=70102&edit=1


Thread (3 messages)

« previous php.bugs (#194561) next »