IMAGEPALETTETOTRUECOLOR(3) 1 IMAGEPALETTETOTRUECOLOR(3)imagepalettetotruecolor - Converts a palette based image to true colorSYNOPSIS
bool imagepalettetotruecolor (resource $src)
DESCRIPTION
Converts a palette based image, created by functions like imagecreate(3) to a true color image, like imagecreatetruecolor(3).
PARAMETERS
o $
image -An image resource, returned by one of the image creation functions, such as imagecreatetruecolor(3).
RETURN VALUES
Returns TRUE if the convertion was complete, or if the source image already is a true color image, otherwise FALSE is returned.
EXAMPLES
Example #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 color
SEE ALSO imagecreatetruecolor(3), imageistruecolor(3).
PHP Documentation Group IMAGEPALETTETOTRUECOLOR(3)
Check Out this Related Man Page
IMAGECREATE(3) 1 IMAGECREATE(3)imagecreate - Create a new palette based imageSYNOPSIS
resource imagecreate (int $width, int $height)
DESCRIPTION imagecreate(3) returns an image identifier representing a blank image of specified size.
In general, we recommend the use of imagecreatetruecolor(3) instead of imagecreate(3) so that image processing occurs on the highest qual-
ity image possible. If you want to output a palette image, then imagetruecolortopalette(3) should be called immediately before saving the
image with imagepng(3) or imagegif(3).
PARAMETERS
o $width
- The image width.
o $height
- The image height.
RETURN VALUES
Returns an image resource identifier on success, FALSE on errors.
EXAMPLES
Example #1
Creating a new GD image stream and outputting an image.
<?php
header("Content-Type: image/png");
$im = @imagecreate(110, 20)
or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 0, 0, 0);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, "A Simple Text String", $text_color);
imagepng($im);
imagedestroy($im);
?>
The above example will output something similar to:[NOT DISPLAYABLE MEDIA]Output of example : Creating a new GD image stream and
outputting an image.
SEE ALSO imagedestroy(3), imagecreatetruecolor(3).
PHP Documentation Group IMAGECREATE(3)
Hi all! I am in need of some advice. I have a sco open server with NO redundancy. I am exploring different ways of trying to backup everything. Either to an image (ghost) or tape. Only problem is I dont know how. Using ghost in windows is pretty straight forward, but not know much about unix I... (1 Reply)
Hi,
My source file happens to be src.src with following contents:
1,liv 52,syrup,twice a day,children
When I do a :
for ii in `cat src.src`
do
echo $ii
medicine_name=`echo $ii | cut -f -d2","`
echo $medicine_name
done
I get output of
echo $medicine_name
as :
an the output of... (2 Replies)
Hi,
Please can anyone advise if Acronis true image can be used to take a image backup of the disk on sco unixware 7.1.4 and what version of software would I need to use this. The FS are vxfs. Would I need to power off the server before I can use this.
Thanks (1 Reply)