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

From: Date: Sun, 19 Jul 2015 17:34:52 +0000
Subject: Bug #70102 [Opn->Ana]: imagecreatefromwebm() shifts colors
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194559@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:             Open
+Status:             Analyzed
 Type:               Bug
 Package:            GD related
 Operating System:   *
 PHP Version:        5.6.11
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

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


Previous Comments:
------------------------------------------------------------------------
[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 (#194559) next »