php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50269 getting and setting (new) transparant color error
Submitted: 2009-11-23 10:39 UTC Modified: 2009-11-23 10:57 UTC
From: ericbruggema at hotmail dot com Assigned: pajoye (profile)
Status: Not a bug Package: GD related
PHP Version: 5.3SVN-2009-11-23 (SVN) OS: WinXP Sp3 dutch
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ericbruggema at hotmail dot com
New email:
PHP Version: OS:

 

 [2009-11-23 10:39 UTC] ericbruggema at hotmail dot com
Description:
------------
The problem is that when reading a transparant color from an existing image in some cases can't be used to set the transparant color for new images.

Reproduce code:
---------------
$im = imagecreatefromgif("image.gif");

$trnprt_indx  = imagecolortransparent($im); 
$trnprt_color = @imagecolorsforindex($im, $trnprt_indx); // error line


Expected result:
----------------
imagecolorsforindex() [<a href='function.imagecolorsforindex'>function.imagecolorsforindex</a>]: Color index 251 out of range



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-23 10:55 UTC] pajoye@php.net
if the image is a palette image and has only 10 colors, trying to use the color 11 will obviously fail.
 [2009-11-23 10:57 UTC] ericbruggema at hotmail dot com
er?? the current image will be copied to a new image (thumb) but i'd like to keep the current 'transparant' color, but this gives an error... looks like the index for the transparant color (current image) doesn't exists in the color palette... (current image)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 02:01:38 2025 UTC