SixLabors/ImageSharp · error · InvalidIccProfileException

Invalid TIFF ICC profile.

Error message

Invalid TIFF ICC profile.

What it means

When building TIFF frame metadata, the decoder reads the embedded ICC profile tag and validates it with CheckIsValid(). If the profile fails validation (bad header, wrong size, malformed data), it throws InvalidIccProfileException instead of attaching a broken profile.

Solutions

  1. Strip or replace the broken ICC profile: e.g. exiftool '-icc_profile<' or tiffcp (dropping custom tags) to produce a clean file.
  2. Embed a known-good ICC profile with exiftool/icc-tool and reload.
  3. Catch InvalidIccProfileException and load while ignoring color management (ImageData may still be read by other decoders).

Example fix

// before
using var image = Image.Load(path); // InvalidIccProfileException
// after
try
{
    using var image = Image.Load(path);
}
catch (InvalidIccProfileException)
{
    // proceed without embedded profile or repair it externally:
    // exiftool "-icc_profile=" path
}
Defensive patterns

Strategy: try-catch

Try / catch

try
{
    using var img = Image.Load(path);
}
catch (InvalidIccProfileException)
{
    // drop or repair the profile: exiftool "-icc_profile=" path, then retry
}

Prevention

When it happens

Trigger: Image.Load/Identify of a TIFF whose ICC profile tag (34675) contains bytes that fail ICC profile validation — bad header signature, invalid size fields, or truncated profile data.

Common situations: Files color-managed by tools that wrote truncated or malformed ICC blobs; profiles stripped/re-embedded incorrectly by third-party software; corrupted downloads.

Understand the failure class

Background: Checksum mismatch errors: "checksum verification failed", "digest mismatch", "expected vs actual checksum" — what they mean and how to fix them — this error's family across 41 libraries.

Related errors


AI-assisted analysis of SixLabors/ImageSharp@59ce6af6fc (2026-09-13). Data as JSON: /api/errors/3c796fc1f077a4dc. Report an issue: GitHub.

Appendix: source

Thrown at src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs:302

        ImageFrameMetadata imageFrameMetaData = new();
        if (!this.skipMetadata)
        {
            imageFrameMetaData.ExifProfile = tags;

            // We resolve the ICC profile early so that we can use it for color conversion if needed.
            if (tags.TryGetValue(ExifTag.IccProfile, out IExifValue<byte[]> iccProfileBytes))
            {
                this.ExecuteAncillarySegmentAction(
                    () =>
                    {
                        IccProfile profile = new(iccProfileBytes.Value);
                        if (profile.CheckIsValid())
                        {
                            imageFrameMetaData.IccProfile = profile;
                        }
                        else
                        {
                            throw new InvalidIccProfileException("Invalid TIFF ICC profile.");
                        }
                    });
            }
        }

        TiffFrameMetadata tiffMetadata = TiffFrameMetadata.Parse(tags);
        imageFrameMetaData.SetFormatMetadata(TiffFormat.Instance, tiffMetadata);

        return (imageFrameMetaData, tiffMetadata);
    }

    /// <summary>
    /// Decodes the image data for Tiff's which arrange the pixel data in stripes.
    /// </summary>
    /// <typeparam name="TPixel">The pixel format.</typeparam>
    /// <param name="tags">The IFD tags.</param>
    /// <param name="frame">The image frame to decode into.</param>
    /// <param name="width">The width in px units of the frame data.</param>

View on GitHub (pinned to 59ce6af6fc)