Jump to content

GD image quality question?


Recommended Posts

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]
[code]
$im=imagecreatefromstring(file_get_contents($file));
header("Content-type: image/jpeg");
imagepng($im);
[/code]

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]
[code]
header("Content-type: image/jpeg");
echo file_get_contents($file);
[/code]

Thanks for any input!
Link to comment
https://forums.phpfreaks.com/topic/11453-gd-image-quality-question/
Share on other sites

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]
[code]imagejpeg ( resource image [, string filename [, int quality]] )[/code]

PNG images however will have quality preserved. (at least here they're good).
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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.