This project has moved and is read-only. For the latest updates, please go here.

Convert From TIF to JPG - Colors Washed Out In Chrome and Firefox on Mac Only

Sep 30, 2016 at 10:07 PM
I use Magick.NET x86 7.0. I open a TIF (created in Photoshop with LZW compression) with Magick, and with no MagickSettings. I resize to a height of 640. I add ICC profile. I add SRGB ColorProfile. I set ColorSpace to sRGB. I save file as .JPG.

But this image looks washed out in Chrome and Firefox on Mac only. I know that this is due to color management within the two browsers. I’m trying to get the images to work correctly and consistently across all browsers. I’ve gotten it to work with an image created by Photoshop, but not one yet works by Magick.NET. I’ve tried many different settings and ICC profiles, but still no luck yet.

Here’s the code snippet:

MagickImage image = new MagickImage(File.ReadAllBytes("0001161697.tif"));
image.Resize(0, 640);
image.RemoveProfile("8BIM"); // need to use this RemoveProfile() command to remove Photoshop's 8BIM profile which it uses to determine the DPI instead of the standard JPEG resolution settings that were modified.
image.AddProfile(new ColorProfile("sRGB_IEC61966-2-1_black_scaled.icc"));
image.ColorSpace = ColorSpace.sRGB;
image.Density = new Density(96);
image.RenderingIntent = RenderingIntent.Perceptual;
image.Quality = 85;

I can send you the original 0001161697.tif file, ICC profile, image generated by code above (does not work), and image created by Photoshop (does work).

Let me know if you need this and more info.
Oct 3, 2016 at 8:25 PM
It would help if you share your image on something like DropBox/OneDrive. Have you tried the TransformColorSpace method?
Oct 3, 2016 at 8:30 PM
I have not tried the TransformColorSpace method yet. I will try that first before I send you the TIF file. Thank you.
Oct 3, 2016 at 8:40 PM
I realize you can't use the TransformColorSpace method until you know the source profile. I don't know how to find that out in my image. So I am sending you a link to the TIF image. Can you please tell me what to do, to convert this TIF image into a 96 DPI JPEG with a height of 640px and that will display correctly in all browsers?!AuNYVxlsQ5rTgQCjsJSR-kzScQG-
Oct 3, 2016 at 9:32 PM
Does your problem only occur on a Mac or also on other operating systems? The image looks fine under Windows. Have you tried to removing the line image.RemoveProfile("8BIM"); ? The 8bim profile should be updated when you write the image.
Oct 3, 2016 at 9:36 PM
Yes. The only time the user experiences the desaturation issue is in Google Chrome or Firefox on their MacBook Pro only. Safari displays fine. I will remove the .RemoveProfile("8BIM") as you recommend and try another version.
Oct 4, 2016 at 4:13 PM
Hey Dirk, Removing the .RemoveProfile("8BIM") did not help. Did you get a chance to look at the difference in color between Chrome/FF and Safari on a Mac? Also compare the saturation of the image to when you open it in Photoshop on a Mac, or even the Mac picture viewer.
Oct 4, 2016 at 4:57 PM
I don't own a Mac so I cannot test it on there. Maybe you should share an output image on the ImageMagick form and ask Fred Weinhaus for help. You already started a topic there.
Oct 4, 2016 at 4:59 PM
OK, I will do that. Thank you.
Oct 5, 2016 at 4:40 PM
Hi Dirk, I did not get a favorable response from the other forum. What I just need to do, is convert the aforementioned TIF to JPG, sRGB, 96 dpi, 640 height. Can you send me the code snippet that will do this? Thank you in advance.
Oct 5, 2016 at 10:58 PM
I'll try to take a look at it on Friday when I have a day of. Not sure yet how to test this though but the answer from Snibgo in should help me to find it.
Oct 5, 2016 at 11:01 PM
Hi Dirk,

Not to worry. I found the solution. It's really simple. Just call RemoveProfile("icc"). This removes the ICC profile tag only. That way, Chrome and Firefox will assume the operating system's default color profile, which, in most cases, will be sRGB.

Case solved!

Thank you.
Oct 6, 2016 at 8:20 AM
I also suspected that this was the solution but thanks for trying that yourself. And thanks for coming back to this topic with the solution :)
Oct 6, 2016 at 4:12 PM
If I can help the next person with the same problem, I am happy. :)