php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27723 ImageTrueColorToPalette(); buggy
Submitted: 2004-03-26 14:18 UTC Modified: 2004-03-28 19:46 UTC
From: diabl at borderlessrpg dot com Assigned:
Status: Not a bug Package: GD related
PHP Version: 5.0.0RC1 OS: W98
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: diabl at borderlessrpg dot com
New email:
PHP Version: OS:

 

 [2004-03-26 14:18 UTC] diabl at borderlessrpg dot com
Description:
------------
For some reason, this reduces the colors to less than specified in $colors. I tried if it reduced them to the same amount with different images, to 64 colors, one of them became 23 colors, the other one became 34 colors. Both with and without dither.

Reproduce code:
---------------
$image = ImageCreateFromPng( "many_colors_image_here" );
ImageTrueColorToPalette( $image, $dither, $colors );

Expected result:
----------------
Reducing a PNG image to X colors, with or without dither.

Actual result:
--------------
This reduces the image to less colors than X

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-03-28 19:46 UTC] iliaa@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

Assuming this is in fact a valid bug (keep in mind PNG is 
truecolor and when reducing it to pallet, which only had 
256 colors and some colors will be lost) this would be a 
bug in GD library not PHP. 
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Nov 30 18:00:01 2025 UTC