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
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).
Link to comment
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!
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.