Jump to content


Photo

GD image quality question?


  • Please log in to reply
3 replies to this topic

#1 michaellunsford

michaellunsford
  • Members
  • PipPipPip
  • Advanced Member
  • 1,023 posts
  • LocationLouisiana, USA

Posted 08 June 2006 - 12:15 AM

Displaying an image as uploaded has a very nice saturation level, but if i just open it with imagecreate...() and have php redisplay it (no changes) it seems to lose quite a bit of saturation. I have created two examples to see if anyone knows what the issue might be, and any possible fix.


using GD example
[a href=\"http://www.virtual-showcase.net/proofs/gulfsouth/test.php\" target=\"_blank\"]http://www.virtual-showcase.net/proofs/gulfsouth/test.php[/a]
$im=imagecreatefromstring(file_get_contents($file));
header("Content-type: image/jpeg");
imagepng($im);

not using GD example
[a href=\"http://www.virtual-showcase.net/proofs/gulfsouth/test2.php\" target=\"_blank\"]http://www.virtual-showcase.net/proofs/gulfsouth/test2.php[/a]
header("Content-type: image/jpeg");
echo file_get_contents($file);

Thanks for any input!

#2 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 08 June 2006 - 01:26 AM

JPEG images are compressed images. Their compression method/quality may differ depending on the program/version.

The best you can do is increase the generated image's quality.

[a href=\"http://www.php.net/imagejpeg\" target=\"_blank\"]http://www.php.net/imagejpeg[/a]
imagejpeg ( resource image [, string filename [, int quality]] )

PNG images however will have quality preserved. (at least here they're good).
~ D Kuang

#3 michaellunsford

michaellunsford
  • Members
  • PipPipPip
  • Advanced Member
  • 1,023 posts
  • LocationLouisiana, USA

Posted 08 June 2006 - 01:48 AM

I didn't think it mattered before, but since you bring it up, I'll mention it now. I tried upping the jpeg quality and even changed the output to png (using imagepng()), but get the same lower saturation results. It doesn't appear to be tied to jpeg.

Still confused.
thanks for any help!

#4 michaellunsford

michaellunsford
  • Members
  • PipPipPip
  • Advanced Member
  • 1,023 posts
  • LocationLouisiana, USA

Posted 13 June 2006 - 04:44 PM

I just discovered that windows users can't tell the two apart. Only Mac users can see the quality difference.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users