Page 1 of 1

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

Posted: 2016-10-03T11:43:09-07:00
by troyzirk
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;
image.Write("0001161697.jpg");

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.

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

Posted: 2016-10-03T12:25:37-07:00
by dlemstra
The rest of the conversation can be found here: https://magick.codeplex.com/discussions/658402

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

Posted: 2016-10-03T12:29:15-07:00
by snibgo
RenderingIntent modifies the processing in AddProfile, so it's pointless if it comes after AddProfile.

What is "image.ColorSpace = ColorSpace.sRGB;" for? If it isn't already sRGB, the profile must have failed.

Try "identify -verbose" and paste the output here.

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

Posted: 2016-10-04T09:12:18-07:00
by troyzirk
Here is a link to the TIF image file. I am trying to do the following:

- resize to a height of 640.
- save as JPG with 96 dpi.
- ensure the JPG is displayed correctly in all browsers.

When I try to do anything with the TIF file, it always ends up looking washed out in Chrome and Firefox on a Mac only. Safari/Mac is OK. PC is OK. Compare the resulting image side-by-side in a Web browser and Photoshop or the Mac picture viewer. You will see the lemon is too yellow.

TIF - https://1drv.ms/i/s!AuNYVxlsQ5rTgQCjsJSR-kzScQG-
JPG created by Photoshop manually (works) - https://1drv.ms/i/s!AuNYVxlsQ5rTgQIXNax7sAtn59ad
JPG created by Magick.NET (doesn't work) - https://1drv.ms/i/s!AuNYVxlsQ5rTgQHfi5lJAX5OrAhU

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

Posted: 2016-10-04T09:39:59-07:00
by snibgo

Code: Select all

identify -verbose 0001161697-magick.jpg
This includes:

Code: Select all

    icc:copyright: Copyright 1999 Adobe Systems Incorporated
    icc:description: Adobe RGB (1998)
    icc:manufacturer: Adobe RGB (1998)
    icc:model: Adobe RGB (1998)
:
:
    photoshop:ICCProfile: Adobe RGB (1998)
Your file is encoded in AdobeRGB. Some browers will respect this. Other will ignore it, and assume the file is really encoded in sRGB.

For maximum viewability on the web, I suggest you always encode as sRGB, and remove any Photoshop metadata.

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

Posted: 2016-10-04T10:21:14-07:00
by troyzirk
Yes. But how do you do this with Magick.NET? What are the method calls? I've tried many different combinations, and I can't seem to get the Adobe RGB replaced with sRGB.

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

Posted: 2016-10-04T10:53:00-07:00
by snibgo
Sorry, I can't help you debug your code. But it clearly hasn't worked.

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

Posted: 2016-10-04T12:58:57-07:00
by troyzirk
So you don't know how to use Magick.NET to convert the provided TIF to JPG, so that the JPG image is sRGB? So that the Adobe RGB is replaced with sRGB?