GD Library only 256 collors?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Pineriver
Forum Commoner
Posts: 50
Joined: Fri Aug 15, 2003 5:24 pm

GD Library only 256 collors?

Post by Pineriver »

Hi, I posted a while back that I was having some trouble with copying a PNG to a JPEG, and I heard that when using the GD library it converts images to to 256 collors, losing some of the quality. I am wondering is there a formula or a way to work around this so it will not lose any of the quality?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

afaik that depends on your version of libgd and the image-resources.
with gd2, imagecopyresampled and truecolor png/jpeg images I cannot see any color and/or quality loss
Pineriver
Forum Commoner
Posts: 50
Joined: Fri Aug 15, 2003 5:24 pm

Post by Pineriver »

hmm, maybe its the rong GD version I have, where dose it tell the info about that in phpinfo() ?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

gd
GD Support enabled
GD Version bundled (2.0.15 compatible)
right after "ftp" and before "gettext" ;-)
pootergeist
Forum Contributor
Posts: 273
Joined: Thu Feb 27, 2003 7:22 am
Location: UK

Post by pootergeist »

1.6.2 was restricted to a 256 indices palette in most functions
1.8.4 could preserve the palette in imagecreatefrom... calls though was still restricted to 256 colours when using imagecreate

versions of 2.0.0 and above can process truecolour with the imagecreatetruecolor and imagecopyresampled combo along with imagecreatefromjpeg and partially imagecreatefrompng

versionss 2.0.4 and 2.0.9 (if I remember rightly) fixed a few glitches in reading png images.

gif though is restricted to 256 indices no matter what.
Pineriver
Forum Commoner
Posts: 50
Joined: Fri Aug 15, 2003 5:24 pm

Post by Pineriver »

TY all of you! :-)
Post Reply