SixLabors/ImageSharp · error · InvalidIccProfileException

Invalid entry .

Error message

Invalid entry {tag}.

What it means

Thrown by IccConverterBase.InitA when the ICC profile's A-to-B tag exists but its TagDataEntry is not one of the supported LUT types (lut8, lut16, lutAtoB, lutBtoA). ImageSharp cannot build the color conversion pipeline from this entry, so the profile is declared invalid.

Solutions

  1. Re-encode the ICC profile with standard lut16/lutAtoB A2B entries (e.g. re-export it with a color management tool such as littleCMS icc2icc or Photoshop).
  2. Use a different ICC profile version (v2/v4 matrix or LUT-based) instead of a v5 multiProcessElements one.
  3. Catch InvalidIccProfileException and fall back to a built-in/default profile.

Example fix

// before: using a v5 ICC profile with multiProcessElements A2B
var converter = new IccConverter(loadedV5Profile);
// after: convert the profile to a v4 LUT-based one first
// $ lcms: transicc / icc2ps to regenerate A2B0 as lut16
var converter = new IccConverter(loadV4Profile("device-v4.icc"));
Defensive patterns

Strategy: try-catch

Validate before calling

bool a2bSupported = profile.Tags.TryGetValue(IccProfileTag.A2B0, out var e)
    && e is IccLut8TagDataEntry or IccLut16TagDataEntry or IccLutAToBTagDataEntry or IccLutBToATagDataEntry;
if (!a2bSupported) { /* use a fallback profile */ }

Type guard

static bool IsSupportedLutEntry(IccTagDataEntry e) =>
    e is IccLut8TagDataEntry or IccLut16TagDataEntry or IccLutAToBTagDataEntry or IccLutBToATagDataEntry;

Try / catch

try { var conv = new IccConverter(profile); }
catch (InvalidIccProfileException ex) { logger.LogWarning(ex, "Unsupported ICC LUT entry"); conv = new IccConverter(KnownIccProfiles.SRgb); }

Prevention

When it happens

Trigger: Calling an IccConverter/Init conversion for a profile whose A2B0/A2B1 (or B2A) tag contains a data entry of an unexpected type (e.g. a multiProcessElements or textDescription entry where a LUT entry is required).

Common situations: Loading malformed or non-conformant ICC profiles produced by third-party tools; profiles using the multiProcessElements A2B encoding (v5 perceptual intent), which is not yet implemented in the LUT path.

Related errors


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

Appendix: source

Thrown at src/ImageSharp/ColorProfiles/Icc/IccConverterbase.Conversions.cs:63

            ConversionMethod.A1 => toPcs ?
                                InitA(profile, IccProfileTag.AToB1) :
                                InitA(profile, IccProfileTag.BToA1),
            ConversionMethod.A2 => toPcs ?
                                InitA(profile, IccProfileTag.AToB2) :
                                InitA(profile, IccProfileTag.BToA2),
            ConversionMethod.ColorTrc => InitColorTrc(profile, toPcs),
            ConversionMethod.GrayTrc => InitGrayTrc(profile, toPcs),
            _ => throw new InvalidIccProfileException("Invalid conversion method."),
        };

    private static IVector4Calculator InitA(IccProfile profile, IccProfileTag tag)
        => GetTag(profile, tag) switch
        {
            IccLut8TagDataEntry lut8 => new LutEntryCalculator(lut8),
            IccLut16TagDataEntry lut16 => new LutEntryCalculator(lut16),
            IccLutAToBTagDataEntry lutAtoB => new LutABCalculator(lutAtoB),
            IccLutBToATagDataEntry lutBtoA => new LutABCalculator(lutBtoA),
            _ => throw new InvalidIccProfileException($"Invalid entry {tag}."),
        };

    private static IVector4Calculator InitD(IccProfile profile, IccProfileTag tag)
    {
        IccMultiProcessElementsTagDataEntry entry = GetTag<IccMultiProcessElementsTagDataEntry>(profile, tag)
            ?? throw new InvalidIccProfileException("Entry is null.");

        throw new NotImplementedException("Multi process elements are not supported");
    }

    private static ColorTrcCalculator InitColorTrc(IccProfile profile, bool toPcs)
    {
        IccXyzTagDataEntry redMatrixColumn = GetTag<IccXyzTagDataEntry>(profile, IccProfileTag.RedMatrixColumn);
        IccXyzTagDataEntry greenMatrixColumn = GetTag<IccXyzTagDataEntry>(profile, IccProfileTag.GreenMatrixColumn);
        IccXyzTagDataEntry blueMatrixColumn = GetTag<IccXyzTagDataEntry>(profile, IccProfileTag.BlueMatrixColumn);

        IccTagDataEntry redTrc = GetTag(profile, IccProfileTag.RedTrc);
        IccTagDataEntry greenTrc = GetTag(profile, IccProfileTag.GreenTrc);

View on GitHub (pinned to 59ce6af6fc)