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

Magick.NET is an object-oriented C# interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick.NET
Post Reply
troyzirk
Posts: 4
Joined: 2016-10-03T11:41:05-07:00
Authentication code: 1151

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

Post by troyzirk » 2016-10-03T11:43:09-07:00

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.

User avatar
dlemstra
Posts: 1576
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

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

Post by dlemstra » 2016-10-03T12:25:37-07:00

The rest of the conversation can be found here: https://magick.codeplex.com/discussions/658402
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

snibgo
Posts: 12289
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post by snibgo » 2016-10-03T12:29:15-07:00

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.
snibgo's IM pages: im.snibgo.com

troyzirk
Posts: 4
Joined: 2016-10-03T11:41:05-07:00
Authentication code: 1151

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

Post by troyzirk » 2016-10-04T09:12:18-07:00

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

snibgo
Posts: 12289
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

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

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.
snibgo's IM pages: im.snibgo.com

troyzirk
Posts: 4
Joined: 2016-10-03T11:41:05-07:00
Authentication code: 1151

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

Post by troyzirk » 2016-10-04T10:21:14-07:00

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.

snibgo
Posts: 12289
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post by snibgo » 2016-10-04T10:53:00-07:00

Sorry, I can't help you debug your code. But it clearly hasn't worked.
snibgo's IM pages: im.snibgo.com

troyzirk
Posts: 4
Joined: 2016-10-03T11:41:05-07:00
Authentication code: 1151

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

Post by troyzirk » 2016-10-04T12:58:57-07:00

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?

Post Reply