note 85857 added to function.imagetruecolortopalette

From: Date: Sun, 21 Sep 2008 13:52:02 +0000
Subject: note 85857 added to function.imagetruecolortopalette
Groups: php.notes 
Request: Send a blank email to php-notes+get-144587@lists.php.net to get a copy of this message
>> zmorris at zsculpt dot com I don't have the imageColorMatch() function on my server, but I could slighty improve the quality of the GIF/PNG image by converting it first to 256 colors, then to true colors and finally to the desired number of colors. <?php $dither = true; $colors = 64; $tmp = imageCreateFromJpeg('example.jpg'); $width = imagesX($tmp); $height = imagesY($tmp); imageTrueColorToPalette($tmp, $dither, 256); $image = imageCreateTrueColor($width, $height); imageCopy($image, $tmp, 0, 0, 0, 0, $width, $height); imageDestroy($tmp); imageTrueColorToPalette($image, $dither, $colors); ?> Final $image will still have less than 64 colors, but more than if it was directly converted to 64 colors, and they match the JPEG image more. Dunno why true colors to palette conversions are such a problem... ---- Server IP: 195.207.10.20 Probable Submitter: 81.247.10.79 ---- Manual Page -- http://www.php.net/manual/en/function.imagetruecolortopalette.php Edit -- https://master.php.net/note/edit/85857 Del: integrated -- https://master.php.net/note/delete/85857/integrated Del: useless -- https://master.php.net/note/delete/85857/useless Del: bad code -- https://master.php.net/note/delete/85857/bad+code Del: spam -- https://master.php.net/note/delete/85857/spam Del: non-english -- https://master.php.net/note/delete/85857/non-english Del: in docs -- https://master.php.net/note/delete/85857/in+docs Del: other reasons-- https://master.php.net/note/delete/85857 Reject -- https://master.php.net/note/reject/85857 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#144587) next »