php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70102 imagecreatefromwebm() shifts colors
Submitted: 2015-07-19 17:32 UTC Modified: 2015-07-19 17:34 UTC
From: cmb@php.net Assigned: cmb
Status: Closed Package: GD related
PHP Version: 5.6.11 OS: *
Private report: No CVE-ID:
 [2015-07-19 17:32 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-07-19 17:34 UTC] cmb@php.net
-Status: Open +Status: Analyzed -Assigned To: +Assigned To: cmb
 [2015-07-19 17:34 UTC] 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 20:45 UTC] cmb@php.net
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
 [2015-07-19 20:45 UTC] cmb@php.net
-Status: Analyzed +Status: Closed
 [2015-07-21 14:20 UTC] ab@php.net
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
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Fri Apr 28 04:01:59 2017 UTC