Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

GD image desaturation


Reply

6 Posts   2303 Views

Avatar
1976

8 December 2009 at 8:31am Community Member, 5 Posts

I have a client who is a photographer and he's complaining that when he uploads images into a gallery they appear desaturated.

I have checked in the assets folder and compared the original and the resized versions and he is right, there's about a 10% desaturation.

This wouldn't normally be an issue but as a photographer he finds it unacceptable.

Is there a setting in GD.php I can change?

Any urgent suggestions gratefully received.

Cheers

Avatar
Pigeon

8 December 2009 at 10:56am Community Member, 243 Posts

Depending on the version of SS you are running, setting:

GD::set_default_quality(100);

In your mysite/_config.php file should fix the problem. I think the default quality is about 70 (scale of 1-100). 100 would seem a bit unnessacery to me, and would go for 85 tops. But have a play and see if it fixes it.

Avatar
banal

8 December 2009 at 11:33am Community Member, 901 Posts

I don't think that setting the GD quality will help all that much, because the image will be recompressed and lose quality, no matter how high the JPG quality setting is.
Since your client is a photographer, you might want to suggest that he prepares his images in the right dimensions and you output the original (uploaded) file in the template instead of a resized version.
I have clients like yours and I usually use a custom image subclass that only performs image recalculation if the requested dimensions are other than the source file.

Avatar
1976

9 December 2009 at 8:57am Community Member, 5 Posts

You're right banal, setting the jpg quality makes no difference to the colour shift. It seems to be a GD related problem though as I have seen complaints from other open source application users such as Wordpress with the exact same issue.

There have been some requests on this forum for a change to ImageMagick rather than GD which might be justified if there's no way to get the same levels/saturation as the original.

I am using the gallery module and have chosen to set the large lightwindow popup image to show the original image to get around this. My client will just have to resize these in Photoshop. Unfortunately the preview images will still have a lack of saturation as they need to be resized.

Avatar
alirobe

11 December 2009 at 6:12pm Community Member, 35 Posts

If you are both on Macs + Safari, this could be due to loss of color profiles embedded in the image EXIF data. Test this on a Windows PC and see if the results are the same.

Avatar
banal

11 December 2009 at 9:16pm Community Member, 901 Posts

True. Forgot about color profiles.
If saving from Photoshop, always use "Save for Web". This will remove all embedded Profiles and images will be generally smaller in file size.