note 117410 added to function.imagetruecolortopalette
| From: | AaronG. | Date: | Sat, 06 Jun 2015 04:19:47 +0000 |
| Subject: | note 117410 added to function.imagetruecolortopalette | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-202754@lists.php.net to get a copy of this message | ||
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,
----
Server IP: 72.52.91.14
Probable Submitter: 70.210.79.7
----
Manual Page -- http://php.net/manual/en/function.imagetruecolortopalette.php
Edit -- https://master.php.net/note/edit/117410
Del: integrated -- https://master.php.net/note/delete/117410/integrated
Del: useless -- https://master.php.net/note/delete/117410/useless
Del: bad code -- https://master.php.net/note/delete/117410/bad+code
Del: spam -- https://master.php.net/note/delete/117410/spam
Del: non-english -- https://master.php.net/note/delete/117410/non-english
Del: in docs -- https://master.php.net/note/delete/117410/in+docs
Del: other reasons-- https://master.php.net/note/delete/117410
Reject -- https://master.php.net/note/reject/117410
Search -- https://master.php.net/manage/user-notes.php