Jump to content

Archived

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

michaellunsford

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!

Share this post


Link to post
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).

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
I just discovered that windows users can't tell the two apart. Only Mac users can see the quality difference.

Share this post


Link to post
Share on other sites

×

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.