note 117410 deleted from function.imagetruecolortopalette by cmb
| From: | cmb@php.net | Date: | Tue, 09 Jun 2015 12:09:21 +0000 |
| Subject: | note 117410 deleted from function.imagetruecolortopalette by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-202783@lists.php.net to get a copy of this message | ||
Note Submitter: Aaron G.
----
This function could be used to compress images. . . so one thought. When size is a concern, no-one
needs 16,777,216 colors. Really, one could get away with 100,000 colors without loss of quality.
This is where this function is lacking. The third parameter--number of colors--only takes effect
below 256, which appears to be in accordance to the GIF format. Unfortunately, you can't tell
the image to use "100,000" colors, instead it renders 256--the max. This should be
bugfixed.
Instead, this method will do some of the payload (30% off a PNG) and retains basically full color:
<?php
$palette = ImageCreate($width, $height); //no true-color
ImageCopy($palette, $truecolor, 0, 0, 0, 0, $width, $height);
?>
Hopefully this gets fixed in the future. Happy programming,