SixLabors/ImageSharp · error · InvalidIccProfileException

Invalid curve segment type of

Error message

Invalid curve segment type of {signature}

What it means

ReadCurveSegment dispatches on the curve segment's signature; ICC profiles only define FormulaCurve and SampledCurve segment types. Any other signature means the multi-dimensional/one-dimensional curve element in the profile is nonconformant, so InvalidIccProfileException is thrown.

Solutions

  1. Replace the offending ICC profile with a standard one (sRGB/Adobe RGB) and re-save the image.
  2. Catch InvalidIccProfileException and continue without applying that profile's color transform.
  3. Verify the profile externally (ICC Profile Inspector, color.org validators) to confirm nonconformance, then regenerate it with conformant tooling.

Example fix

// before
using var image = Image.Load(path); // throws on unknown curve segment signature
// after
try
{
    using var image = Image.Load(path);
}
catch (InvalidIccProfileException ex)
{
    logger.LogWarning("Skipping image with bad ICC curve segment: {Msg}", ex.Message);
    return; // or reprocess after stripping the profile
}
Defensive patterns

Strategy: fallback

Try / catch

try { using var image = Image.Load(path); }
catch (InvalidIccProfileException ex) when (ex.Message.Contains("curve segment"))
{ /* fall back to unmanaged color or strip/reassign the profile */ }

Prevention

When it happens

Trigger: Loading an ICC profile containing a multiProcess/multiLocalized or 'curve segment' structure (e.g. inside MAB/MBA tags) whose segment signature is neither 'parf' (formula) nor 'curv'-style sampled — corrupt or vendor-broken profiles.

Common situations: Images carrying ICC v4/v5 (iccMAX) style profiles with segment types ImageSharp doesn't recognize; corrupted color profiles; profiles generated by tools writing unknown signatures.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.Curves.cs:134

    }

    /// <summary>
    /// Reads a <see cref="IccCurveSegment"/>
    /// </summary>
    /// <returns>The read segment</returns>
    public IccCurveSegment ReadCurveSegment()
    {
        IccCurveSegmentSignature signature = (IccCurveSegmentSignature)this.ReadUInt32();
        this.AddIndex(4);   // 4 bytes reserved

        switch (signature)
        {
            case IccCurveSegmentSignature.FormulaCurve:
                return this.ReadFormulaCurveElement();
            case IccCurveSegmentSignature.SampledCurve:
                return this.ReadSampledCurveElement();
            default:
                throw new InvalidIccProfileException($"Invalid curve segment type of {signature}");
        }
    }

    /// <summary>
    /// Reads a <see cref="IccFormulaCurveElement"/>
    /// </summary>
    /// <returns>The read segment</returns>
    public IccFormulaCurveElement ReadFormulaCurveElement()
    {
        IccFormulaCurveType type = (IccFormulaCurveType)this.ReadUInt16();
        this.AddIndex(2);   // 2 bytes reserved
        float gamma, a, b, c, d, e;
        gamma = d = e = 0;

        if (type == IccFormulaCurveType.Type1 || type == IccFormulaCurveType.Type2)
        {
            gamma = this.ReadSingle();
        }

View on GitHub (pinned to 59ce6af6fc)