Jump to content

After GD-Resampling: image looks different in Firefox and IE


the-ninth
 Share

Recommended Posts

Hi Everybody,

 

I am using PHP/GD to resize a photo to a smaller size and my problem is that when I show the result in Firefox, it looks different from the original. The picture has more contrast, especially the dark areas are even darker. When I show the result in Internet Explorer or the Windows Photo Viewer it looks the same as the original photo.

 

The problem also only occurs when I resize the photo with PHP/GD. When I resize it with Adobe Lightroom, then the result looks correct in Firefox and Internet Explorer.

 

Here is an example:

 

With PHP/GD: http://www.the-ninth.com/demo/demo_php.jpg

With Adobe Lightroom: http://www.the-ninth.com/demo/demo_lightroom.jpg

 

When comparing the two photos in Firefox you'll see the difference. In IE they look nearly the same.

 

I am using the following functions to resize:

 

ImageCreateFromJpeg to read the original image,

ImageCreateTrueColor to create the new image,

ImageCopyResampled to write the resized image to the new image and

ImageJpeg with quality 100 to save the new image.

 

Before saving I sharpen the new image. However that is not the problem, I already tried without sharpening and the picture still looks different in Firefox.

 

Any ideas what I am doing wrong?

 

Thanks and regards, Robert

Link to comment
Share on other sites

Hi,

 

I found the problem: when resizing the photo with GD, the color profile is lost.

 

The original file has sRGB. Firefox takes the system profile if there is no profile in the file. In many cases this is sRGB but I have a calibrated monitor and therefore a custom profile. If I set gfx.color_management.mode to 1 in Firefox, then it takes sRGB per default and the photo looks the same.

 

So the big question is how to I retain the color profile with GD? My provider does not has ImageMagick, so that is not an option.

 

Any ideas?

 

Thanks, Robert

Link to comment
Share on other sites

Hi,

 

I had some mistakes in my previous postings, but now I understand the problem better:

 

Internet Explorer does not do color-management, so the image looks the same whether it has a profile or not. The same, but not as I see it in Adobe Lightroom.

 

Firefox does color-management. So if there is a color profile, the image looks exactly like I see it in Adobe Lightroom. If there is none, the image looks like in Internet Explorer. When switching gfx.color_management.mode to 1 then Firefox does color-management, even if there is no profile in the file, it just assumes sRGB. So if the original picture was exported in sRGB, the re-sized one without profile looks correct in mode 1.

 

Since besides Firefox also Safari does color-management and IE9 will do it as well, it was important to me to retain the color profile. I switched my code to ImageMagick, and that works fine. Color profiles are retained when resizing the image.

 

Cheers, Robert

Link to comment
Share on other sites

This thread is more than a year old.

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.

 Share

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