SixLabors/ImageSharp · error · ArgumentOutOfRangeException
Source PCS to target PCS is not supported
Error message
Source PCS {sourceParams.PcsType} to target PCS {targetParams.PcsType} is not supported What it means
GetTargetPcsWithoutAdjustment (single-value path) switches on the PCS color space recorded in the source profile's ConversionParams; the default arm throws because that combination of source/target PCS types has no implemented conversion route. ICC profiles use either XYZ or CIELab as PCS, and only specific pairs are supported for this intent.
Solutions
- Inspect both profiles' header PCS fields (data color space / PCS illuminant signature) and use standard profiles (v2/v4 sRGB, AdobeRGB) whose PCS is XYZ or Lab.
- Re-export or fix the offending profile with a standards-compliant tool (e.g. littleCMS, iccMAX).
- If you believe the PCS pair should be supported, verify profile version and intent — some pairs are only implemented for perceptual handling.
Example fix
// before
var bad = new IccProfile(); // header PCS unsupported
options.SourceIccProfile = bad;
// after
var options = new ColorConversionOptions
{
SourceIccProfile = IccProfile.Parse(File.ReadAllBytes("sRGB v4.icc")), // standard XYZ PCS
TargetIccProfile = target
}; Defensive patterns
Strategy: validation
Validate before calling
IccColorSpaceType pcs = sourceProfile.Header.ColorSpace; // verify PCS field bool ok = pcs is IccColorSpaceType.CieXyz or IccColorSpaceType.CieLab;
Type guard
bool HasKnownPcs(IccProfile p) => p.Header.ColorSpace is IccColorSpaceType.CieXyz or IccColorSpaceType.CieLab;
Try / catch
try { return converter.ConvertUsingIccProfile<TFrom, TTo>(in color); }
catch (ArgumentOutOfRangeException ex)
{ log.Warn(ex, "Unsupported PCS pair"); return fallbackConversion(color); } Prevention
- Only use profiles from trusted, standards-compliant generators.
- Check header PCS signatures when loading profiles.
- Prefer bundled standard v2/v4 profiles over third-party or hand-edited ones.
When it happens
Trigger: Calling ConvertUsingIccProfile where the source profile's PCS color space signature (from profile header) is something other than the supported CieXYZ/CieLab cases for the non-perceptual path — e.g. a malformed or exotic profile header, or a PCS pair that falls through all switch cases.
Common situations: Using hand-edited, corrupt, or nonstandard ICC profiles; profiles generated by tools that write unusual PCS signatures; testing with stub profiles.
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
- Source PCS is not supported
- Target PCS is not supported
- Source ICC profile is missing.
- Target ICC profile is missing.
- Source ICC profile is missing.
AI-assisted analysis of SixLabors/ImageSharp@59ce6af6fc (2026-09-13).
Data as JSON: /api/errors/27a43864bff70eb9.
Report an issue: GitHub.
Appendix: source
Thrown at src/ImageSharp/ColorProfiles/ColorProfileConverterExtensionsIcc.cs:241
// if both source and target LUT use same v2 LAB encoding, no need to correct them
if (sourceParams.Is16BitLutEntry && targetParams.Is16BitLutEntry)
{
CieLab sourceLab = CieLab.FromScaledVector4(sourcePcs);
CieLab targetLab = pcsConverter.Convert<CieLab, CieLab>(in sourceLab);
return targetLab.ToScaledVector4();
}
else
{
sourcePcs = sourceParams.Is16BitLutEntry ? LabV2ToLab(sourcePcs) : sourcePcs;
CieLab sourceLab = CieLab.FromScaledVector4(sourcePcs);
CieLab targetLab = pcsConverter.Convert<CieLab, CieLab>(in sourceLab);
Vector4 targetPcs = targetLab.ToScaledVector4();
return targetParams.Is16BitLutEntry ? LabToLabV2(targetPcs) : targetPcs;
}
}
default:
throw new ArgumentOutOfRangeException($"Source PCS {sourceParams.PcsType} to target PCS {targetParams.PcsType} is not supported");
}
}
private static void GetTargetPcsWithoutAdjustment(
Span<Vector4> pcs,
ConversionParams sourceParams,
ConversionParams targetParams,
ColorProfileConverter pcsConverter)
{
// Profile connecting spaces can only be Lab, XYZ.
// 16-bit Lab encodings changed from v2 to v4, but 16-bit LUTs always use the legacy encoding regardless of version
// so ensure that Lab is using the correct encoding when a 16-bit LUT is used
switch (sourceParams.PcsType)
{
// Convert from Lab to XYZ.
case IccColorSpaceType.CieLab when targetParams.PcsType is IccColorSpaceType.CieXyz:
{
if (sourceParams.Is16BitLutEntry)View on GitHub (pinned to 59ce6af6fc)