This project has moved. For the latest updates, please go here.

Embedded ICC profile issue

May 13, 2014 at 8:37 PM
Edited May 13, 2014 at 8:37 PM
I'm getting the following error when opening up the converted image in Photoshop.:
"The embedded ICC profile cannot be used because the ICC profile is invalid, Ignoring the profile".

Using the following image: https://www.dropbox.com/s/p4dpnkofgezfzwk/23792_004_0676_R_V1.tif

And using the following code:
        var destinationStream = new FileStream("output.jpg", FileMode.OpenOrCreate);
        MagickImage magickImage;

        //source is the tifFile
        magickImage = new MagickImage(tifFile);

        magickImage.Strip();

        magickImage.Format = MagickFormat.Jpg;
        magickImage.ResolutionUnits = Resolution.PixelsPerInch;
        magickImage.Density = new MagickGeometry(300, 300);

        magickImage.Write(destinationStream);

        MagickImage magickImageDestination = null;

        destinationStream.Seek(0, SeekOrigin.Begin);
        magickImageDestination = new MagickImage(destinationStream);

        //sourceFile is the tif file again
        MagickImage magickImageSource = new MagickImage(tifFile);

        ColorProfile cp = magickImageSource.GetColorProfile();

        if (cp != null)
        {
            magickImageDestination.AddProfile(cp);
        }

        destinationStream.SetLength(0);
        magickImageDestination.Write(destinationStream);
Coordinator
May 13, 2014 at 9:26 PM
I don't have or use Photoshop so I cannot run some tests myself. Is it possible that Photoshop is complaining about an Adobe RGB color profile in a GrayScale image?
May 13, 2014 at 9:48 PM
I suppose it's possible. But Photoshop is able to open up the original just fine. And within Photoshop, if I save that as a jpg, that's fine as well. I'm not sure where to look next.
Coordinator
May 14, 2014 at 4:43 AM
Can you e-mail me the jpeg you saved from Photoshop so I can compare it with the image created by Magick.NET?
May 14, 2014 at 12:00 PM
Edited May 14, 2014 at 12:52 PM
Jumping in here. With Adobe Photoshop CS4 Extended I get an error with the image.

"The embedded ICC profile cannot be used because the ICC profile is invalid. Ignoring the profile."
[Continue] [Cancel]

The profile is "Adobe RGB (1998)". The ColorMode is RGB. Perhaps it is because the ICC does not match the image. I'm not sure what type of ICC profile a grayscale image should have.

Dumped from ExifToolGui.
---- ICC_Profile ----
Profile CMM Type : ADBE
Profile Version : 2.1.0
Profile Class : Display Device Profile
Color Space Data : RGB
Profile Connection Space : XYZ
Profile Date Time : 1999:06:03 00:00:00
Profile File Signature : acsp
Primary Platform : Apple Computer Inc.
CMM Flags : Not Embedded, Independent
Device Manufacturer : none
Device Model :
Device Attributes : Reflective, Glossy, Positive, Color
Rendering Intent : Perceptual
Connection Space Illuminant : 0.9642 1 0.82491
Profile Creator : ADBE
Profile ID : 0
Profile Copyright : Copyright 1999 Adobe Systems Incorporated
Profile Description : Adobe RGB (1998)
Media White Point : 0.95045 1 1.08905
Media Black Point : 0 0 0
Red Tone Reproduction Curve : (Binary data 14 bytes, use -b option to extract)
Green Tone Reproduction Curve : (Binary data 14 bytes, use -b option to extract)
Blue Tone Reproduction Curve : (Binary data 14 bytes, use -b option to extract)
Red Matrix Column : 0.60974 0.31111 0.01947
Green Matrix Column : 0.20528 0.62567 0.06087
Blue Matrix Column : 0.14919 0.06322 0.74457


Darren
Coordinator
May 14, 2014 at 12:42 PM
Are you talking about the original image or the image created with the code in this post?
May 14, 2014 at 1:26 PM
dlemstra wrote:
Are you talking about the original image or the image created with the code in this post?
Sorry. I was talking about the original TIFF linked in the first thread of this discussion.
May 14, 2014 at 1:53 PM
Edited May 14, 2014 at 1:53 PM
Hmmm. I guess I used a different version when I ran my test. Sorry about that guys. And thanks
May 16, 2014 at 1:34 PM
Here's the version I should have posted originally.

https://www.dropbox.com/s/p4dpnkofgezfzwk/23792_004_0676_R_V1.tif

This is the real original.
May 16, 2014 at 4:42 PM
I can load this image without issue in IM.Net. Are you saying you're still having problems with it? This image is, in fact, Color RGB with an ICC Profile of "Adobe RGB (1998)" even though it looks gray.

Darren
May 16, 2014 at 5:00 PM
I'm able to open the original in Photoshop without issue. If I use the code above, the resulting image(.jpg) gives me the embedded ICC message in Photoshop.

It appears that I am able to get around the above Photoshop error by adding the following line before I write it to the destination Stream at the end:

magickImageDestination.ColorType = ColorType.TrueColor;

Now, to be clear, and I'm sure you know by now, I'm not an image expert. So I am not sure if the above line produces results that are unfavorable in other ways.
May 19, 2014 at 1:55 PM
I think that is correct because you're telling IM to make the output the proper bit depth.