IMAGETRUECOLORTOPALETTE(3) 1 IMAGETRUECOLORTOPALETTE(3)imagetruecolortopalette - Convert a true color image to a palette imageSYNOPSIS
bool imagetruecolortopalette (resource $image, bool $dither, int $ncolors)
DESCRIPTION imagetruecolortopalette(3) converts a truecolor image to a palette image. The code for this function was originally drawn from the Indepen-
dent JPEG Group library code, which is excellent. The code has been modified to preserve as much alpha channel information as possible in
the resulting palette, in addition to preserving colors as well as possible. This does not work as well as might be hoped. It is usually
best to simply produce a truecolor output image instead, which guarantees the highest output quality.
PARAMETERS
o $
image -An image resource, returned by one of the image creation functions, such as imagecreatetruecolor(3).
o $dither
- Indicates if the image should be dithered - if it is TRUE then dithering will be used which will result in a more speckled image
but with better color approximation.
o $ncolors
- Sets the maximum number of colors that should be retained in the palette.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
Converting a true color image to a palette-based image
<?php
// Create a new true color image
$im = imagecreatetruecolor(100, 100);
// Convert to palette-based with no dithering and 255 colors
imagetruecolortopalette($im, false, 255);
// Save the image
imagepng($im, './paletteimage.png');
imagedestroy($im);
?>
NOTES
Note
This function requires GD 2.0.1 or later (2.0.28 or later is recommended).
PHP Documentation Group IMAGETRUECOLORTOPALETTE(3)
Check Out this Related Man Page
IMAGECOLORSTOTAL(3) 1 IMAGECOLORSTOTAL(3)imagecolorstotal - Find out the number of colors in an image's paletteSYNOPSIS
int imagecolorstotal (resource $image)
DESCRIPTION
Returns the number of colors in an image palette.
PARAMETERS
o $image
- An image resource, returned by one of the image creation functions, such as imagecreatefromgif(3).
RETURN VALUES
Returns the number of colors in the specified image's palette or 0 for truecolor images.
EXAMPLES
Example #1
Getting total number of colors in an image using imagecolorstotal(3)
<?php
// Create image instance
$im = imagecreatefromgif('php.gif');
echo 'Total colors in image: ' . imagecolorstotal($im);
// Free image
imagedestroy($im);
?>
The above example will output something similar to:
Total colors in image: 128
SEE ALSO imagecolorat(3), imagecolorsforindex(3), imageistruecolor(3).
PHP Documentation Group IMAGECOLORSTOTAL(3)
Solaris 2.6, using CDE:
agh. I accidentally set an ugly palette as my Home Session. The problem is, when I change the palette back to Default, I am informed that my change will be apparent in my next session. But when I log out and in, it's still the Ugly Palette. Doesn't matter if I set the... (1 Reply)
This is the error that I am getting while retrieving image from image server using system imager....
Listening on LPF/lo/<null>
sending on Socket/fallback/fallback-net
DHCPDISCOVER on lo to 255.255.255.255 port 67 interval 5
DHCPDISCOVER on lo to 255.255.255.255 port 67 interval5... (1 Reply)
Hi all,
Actually I want to flash the image which I have in my system and when I am trying to do it,it is not showing it.simply creates the frame but not displaying the image.I am attaching the code--
Please take a look on it and please provide your valuable suggestions on it so that I... (2 Replies)
I'm trying to convert a file with the following command:
convert -verbose image.eps -resize 500x image.jpg
The problem is that the output image loses it's quality and gets all blurred when resized. It shouldn't happen since I'm working with a vector.
I'm pretty sure that I'm missing a... (0 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)