SixLabors/ImageSharp · error · InvalidIccProfileException

Invalid MultiProcessElement type of

Error message

Invalid MultiProcessElement type of {value.Signature}

What it means

When writing a multiProcessElement, the writer switches on the element's Signature to pick the serialization routine. Signatures outside the implemented set (curveSet, clut, matrix, bAcs, eAcs, etc.) have no writer implementation and cause this throw. Notably this is a writer-side limitation: valid ICC MPE types the library cannot yet serialize still fail.

Solutions

  1. Use only MPE types the library implements (setCurve, clut, matrix, bAcs, eAcs) when authoring profiles.
  2. Upgrade ImageSharp - newer versions support more MPE signatures.
  3. Replace or drop unsupported elements from the profile before re-serializing.
  4. Catch InvalidIccProfileException during profile save and skip/error out for that profile.
Defensive patterns

Strategy: validation

Validate before calling

// Check the element signature is one the writer implements before serializing
static bool IsWritable(IccMultiProcessElement e) =>
    e.Signature is IccMultiProcessElementSignature.CurveSet or
      IccMultiProcessElementSignature.Clut or
      IccMultiProcessElementSignature.Matrix or
      IccMultiProcessElementSignature.BAcs or
      IccMultiProcessElementSignature.EAcs;

Try / catch

try { writer.WriteMultiProcessElement(element); }
catch (InvalidIccProfileException ex) when (ex.Message.Contains("MultiProcessElement"))
{
    logger.LogWarning(ex, "Skipping unwritable MPE type {Sig}", element.Signature);
}

Prevention

When it happens

Trigger: Calling IccDataWriter.WriteMultiProcessElement (directly or via size()/WriteMultiProcessElementsTagDataEntry) with an IccMultiProcessElement whose Signature is a valid-ICC but unimplemented type, or an invalid/corrupt signature read from another profile.

Common situations: Round-tripping ICC profiles: reading an mAB/mBA tag containing a newer MPE type (unsupported on read or default-initialized), then writing the profile back out; programmatic profile generation with the wrong element type.

Related errors


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

Appendix: source

Thrown at src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.MultiProcessElement.cs:36

        int count = this.WriteUInt32((uint)value.Signature);
        count += this.WriteUInt16((ushort)value.InputChannelCount);
        count += this.WriteUInt16((ushort)value.OutputChannelCount);

        switch (value.Signature)
        {
            case IccMultiProcessElementSignature.CurveSet:
                return count + this.WriteCurveSetProcessElement((IccCurveSetProcessElement)value);
            case IccMultiProcessElementSignature.Matrix:
                return count + this.WriteMatrixProcessElement((IccMatrixProcessElement)value);
            case IccMultiProcessElementSignature.Clut:
                return count + this.WriteClutProcessElement((IccClutProcessElement)value);

            case IccMultiProcessElementSignature.BAcs:
            case IccMultiProcessElementSignature.EAcs:
                return count + this.WriteEmpty(8);

            default:
                throw new InvalidIccProfileException($"Invalid MultiProcessElement type of {value.Signature}");
        }
    }

    /// <summary>
    /// Writes a CurveSet <see cref="IccMultiProcessElement"/>
    /// </summary>
    /// <param name="value">The element to write</param>
    /// <returns>The number of bytes written</returns>
    public int WriteCurveSetProcessElement(IccCurveSetProcessElement value)
    {
        int count = 0;
        foreach (IccOneDimensionalCurve curve in value.Curves)
        {
            count += this.WriteOneDimensionalCurve(curve);
            count += this.WritePadding();
        }

        return count;

View on GitHub (pinned to 59ce6af6fc)