Re: imagetruecolortopalette returns a max of 128 colors
- From: Tim Roberts <timr@xxxxxxxxx>
- Date: Mon, 31 Dec 2007 21:44:12 GMT
Vegethalia <vegethalia@xxxxxxxxx> wrote:
I'm sure that im doing something wrong, but I can't imagine what!
My problem is the following:
I create an image using imagecreatetruecolor, and, after some
painting, I push the resulting image to the client in 256 colors:
imagetruecolortopalette($this->m_oIMG, false, 256);
header("Content-type: image/png");
if(!imagepng($this->m_oIMG)) echo("Error Creating Image!!!");
The problem is that the resulting image never contain more that 128
colors! I can't push the 24bit image because of the size, as the
images are pretty big.
24-bit images are only three times larger than 8-bit images. The image on
your page is only 150k bytes; 450k is not that big.
As you may imagine, the final image quality is quite horrible, for an
example,
http://eqsearchpro.pleyhades.com/ShowRecipe.php?item=8668&recipe=26059
save the image and open it with photoshop (for instance...), after
that, count the colors.
I don't think that image looks bad. If you want smooth coloring, than keep
it as true color.
Any ideas? :)
The "imagetruecolortopalette" page in the PHP documentation mentions an
alternative. If you know which 256 colors you want, create an empty image
with the palette you want, and use imagecopy to copy into that image.
If you eventually want a palettized image, why don't you create it as
palettized to begin with? Converting a true-color image to palettized is
an expensive operation.
--
Tim Roberts, timr@xxxxxxxxx
Providenza & Boekelheide, Inc.
.
- References:
- imagetruecolortopalette returns a max of 128 colors
- From: Vegethalia
- imagetruecolortopalette returns a max of 128 colors
- Prev by Date: Re: creating a cumulative total column, but not in sequence
- Next by Date: Re: Some strings are not true ?
- Previous by thread: imagetruecolortopalette returns a max of 128 colors
- Next by thread: project takeover/need help clearing easy bugs
- Index(es):