Bug #67325 [Opn]: imagetruecolortopalette: many colors in palette are missing

From: Date: Mon, 10 Nov 2014 14:02:38 +0000
Subject: Bug #67325 [Opn]: imagetruecolortopalette: many colors in palette are missing
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188535@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67325&edit=1

 ID:                 67325
 Updated by:         pajoye@php.net
 Reported by:        icp at freigre dot com
 Summary:            imagetruecolortopalette: many colors in palette are
                     missing
 Status:             Open
 Type:               Bug
 Package:            GD related
 PHP Version:        5.5.12
 Block user comment: N
 Private report:     N

 New Comment:

Given that the default algo works with similar colors to create palettes, it sounds like we may not
be able to fix it.



@remi have you tried using the new algo? Afair it is not exposed in php but it provides a way better
quality in that regard.


Previous Comments:
------------------------------------------------------------------------
[2014-11-08 07:42:29] remi@php.net

I can reproduce, with php 5.4.34 (bundled libgd) and 5.6.3RC1 (system libgd)

Result (with or without dither) have 187 different colors, 70 are white.

------------------------------------------------------------------------
[2014-05-22 11:42:22] icp at freigre dot com

Description:
------------
This bug has been already posted 2004 here:
https://bugs.php.net/bug.php?id=28949

But the bug is still alive in PHP 5.5!

I convert a truecolor image with 1000s of different colors into a palette image using

imagetruecolortopalette ($image, no, 256)

But the palette of the resulting image doesn't contain the 256 most appearing individual colors
of the original truecolor image. Many of the palette colors are just white (RGB value: #FF FF FF).
For example just 120 colors are individual, the rest of 136 palette entries is white.
This results in a worse color reproduction of the palette image than it should be using 256
individual colors.

Please fix this bug, since imagetruecolortopalette is very important for creating small-filesized
GIF and PNG images. Their filesize is dramatically lower than its truecolor counterpart while
retaining satisfying output quality.



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



--
Edit this bug report at https://bugs.php.net/bug.php?id=67325&edit=1


Thread (5 messages)

« previous php.bugs (#188535) next »