#40801 [Opn->Fbk]: imagecolorat works incorrectly with imagecreatefromgif and imagecreatefrompng
| From: | tony2001@php.net | Date: | Wed, 14 Mar 2007 09:59:08 +0000 |
| Subject: | #40801 [Opn->Fbk]: imagecolorat works incorrectly with imagecreatefromgif and imagecreatefrompng | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-110328@lists.php.net to get a copy of this message | ||
ID: 40801
Updated by: tony2001@php.net
Reported By: belkovich at yandex dot ru
-Status: Open
+Status: Feedback
Bug Type: GD related
Operating System: Win XP Pro
PHP Version: 5.2.1
New Comment:
Put those images online, so we can actually use your code to reproduce
it (without the pictures it's useless).
Previous Comments:
------------------------------------------------------------------------
[2007-03-14 09:53:43] belkovich at yandex dot ru
Description:
------------
Hello
imagecolorat works incorrectly with imagecreatefromgif and
imagecreatefrompng
and it works with imagecreatefromjpeg
Here is working code:
<?php
$im = imagecreatefromjpeg("Capture.jpg");
$rgb = imagecolorat($im,10,10);
echo $rgb;
$r = ($rgb >> 16) & 0xFF;
$g = ($rgb >> 8) & 0xFF;
$b = $rgb & 0xFF;
echo $r."_".$g."_".$b;
?>
Sincerely,
Dmitry
Reproduce code:
---------------
<?php
$im = imagecreatefromgif("Capture.gif");
$rgb = imagecolorat($im,10,10);
echo $rgb;
$r = ($rgb >> 16) & 0xFF;
$g = ($rgb >> 8) & 0xFF;
$b = $rgb & 0xFF;
echo $r."_".$g."_".$b;
?>
Expected result:
----------------
255_255_255 on white color, when use imagecolorat with jpg
Actual result:
--------------
0_0_106 on white color, when use PNG imagecreatefrompng) or
imagecreatefromgif(with GIF file)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40801&edit=1