ID:               40801
 Updated by:       [EMAIL PROTECTED]
 Reported By:      belkovich at yandex dot ru
-Status:           Feedback
+Status:           Bogus
 Bug Type:         GD related
 Operating System: Win XP Pro
 PHP Version:      5.2.1
 New Comment:

imagecolorat returns the color index (position in the palette) for
palette based image or the color value for true color images.

imagecreatefromjpeg creates true color images, always.
imagecreatefromgif creates always palette based images and
imagecreatefrompng creates either palette or true color images as PNG
supports both image types.


Previous Comments:
------------------------------------------------------------------------

[2007-03-14 09:59:08] [EMAIL PROTECTED]

Put those images online, so we can actually use your code to reproduce
it (without the pictures it's useless).

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

[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

Reply via email to