Query: imagepalettetotruecolor
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
IMAGEPALETTETOTRUECOLOR(3) 1 IMAGEPALETTETOTRUECOLOR(3) imagepalettetotruecolor - Converts a palette based image to true colorSYNOPSISbool imagepalettetotruecolor (resource $src)DESCRIPTIONConverts a palette based image, created by functions like imagecreate(3) to a true color image, like imagecreatetruecolor(3).PARAMETERSo $ image -An image resource, returned by one of the image creation functions, such as imagecreatetruecolor(3).RETURN VALUESReturns TRUE if the convertion was complete, or if the source image already is a true color image, otherwise FALSE is returned.EXAMPLESExample #1 Converts any image resource to true color <?php // Backwards compatiblity if(!function_exists('imagepalettetotruecolor')) { function imagepalettetotruecolor(&$src) { if(imageistruecolor($src)) { return(true); } $dst = imagecreatetruecolor(imagesx($src), imagesy($src)); imagecopy($dst, $src, 0, 0, 0, 0, imagesx($src), imagesy($src)); imagedestroy($src); $src = $dst; return(true); } } // Helper closure $typeof = function() use($im) { echo 'typeof($im) = ' . (imageistruecolor($im) ? 'true color' : 'palette'), PHP_EOL; }; // Create a palette based image $im = imagecreate(100, 100); $typeof(); // Convert it to true color imagepalettetotruecolor($im); $typeof(); // Free the memory imagedestroy($im); ?> The above example will output: typeof($im) = palette typeof($im) = true colorSEE ALSOimagecreatetruecolor(3), imageistruecolor(3). PHP Documentation Group IMAGEPALETTETOTRUECOLOR(3)
Related Man Pages |
---|
imagecreatetruecolor(3) - php |
imagealphablending(3) - php |
imagecolorset(3) - php |
imagefill(3) - php |
imageistruecolor(3) - php |
Similar Topics in the Unix Linux Community |
---|
image src to raid5 sco open server |
New committer: Konrad Jankowski (src) - SoC2008 alumnus. |
Problem with echo and cut |
Acronis true image for UNIXware 7.1.4 |