{"record":{"id":"91096179a6bb15d9","repo":"SixLabors/ImageSharp","slug":"parametriccurve","errorCode":null,"errorMessage":"ParametricCurve","messagePattern":"ParametricCurve","errorType":"exception","errorClass":"InvalidIccProfileException","httpStatus":null,"severity":"error","filePath":"src/ImageSharp/ColorProfiles/Icc/Calculators/ParametricCurveCalculator.cs","lineNumber":40,"sourceCode":"        {\n            this.type |= InvertedFlag;\n        }\n    }\n\n    public float Calculate(float value)\n        => this.type switch\n        {\n            IccParametricCurveType.Type1 => this.CalculateGamma(value),\n            IccParametricCurveType.Cie122_1996 => this.CalculateCie122(value),\n            IccParametricCurveType.Iec61966_3 => this.CalculateIec61966(value),\n            IccParametricCurveType.SRgb => this.CalculateSRgb(value),\n            IccParametricCurveType.Type5 => this.CalculateType5(value),\n            IccParametricCurveType.Type1 | InvertedFlag => this.CalculateInvertedGamma(value),\n            IccParametricCurveType.Cie122_1996 | InvertedFlag => this.CalculateInvertedCie122(value),\n            IccParametricCurveType.Iec61966_3 | InvertedFlag => this.CalculateInvertedIec61966(value),\n            IccParametricCurveType.SRgb | InvertedFlag => this.CalculateInvertedSRgb(value),\n            IccParametricCurveType.Type5 | InvertedFlag => this.CalculateInvertedType5(value),\n            _ => throw new InvalidIccProfileException(\"ParametricCurve\"),\n        };\n\n    [MethodImpl(MethodImplOptions.AggressiveInlining)]\n    private float CalculateGamma(float value) => MathF.Pow(value, this.curve.G);\n\n    [MethodImpl(MethodImplOptions.AggressiveInlining)]\n    private float CalculateCie122(float value)\n    {\n        if (value >= -this.curve.B / this.curve.A)\n        {\n            return MathF.Pow((this.curve.A * value) + this.curve.B, this.curve.G);\n        }\n\n        return 0;\n    }\n\n    [MethodImpl(MethodImplOptions.AggressiveInlining)]\n    private float CalculateIec61966(float value)","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/SixLabors/ImageSharp/blob/59ce6af6fc29027cda277ef62d4d1694a8acce91/src/ImageSharp/ColorProfiles/Icc/Calculators/ParametricCurveCalculator.cs#L22-L58","documentation":"ParametricCurveCalculator.Calculate throws InvalidIccProfileException(\"ParametricCurve\") when the parametric curve type (including inversion flag) matches no known ICC parametric curve type (Type0–Type5 / Cie122-1996 / Iec61966-3 / SRgb and their inverted forms). The profile contains a para tag whose curve type value is outside the ICC specification set.","triggerScenarios":"Converting with an ICC profile whose parametricCurveType tag data carries an unrecognized type code (e.g. >5 or reserved values), then invoking the TRC/Calculate path.","commonSituations":"Corrupt or truncated 'para' tag data; profiles written by buggy encoders that emit wrong type bytes; hand-crafted profiles for testing.","solutions":["Replace or re-export the ICC profile with a standard tool so para tags use valid types 0–5.","Pre-validate parametric curve type codes before conversion and reject invalid profiles.","Report a library bug if the type value is within the ICC spec but still rejected."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { converter.Convert(...); }\ncatch (InvalidIccProfileException ex) when (ex.Message == \"ParametricCurve\") { logger.LogWarning(ex, \"Profile contains invalid parametric curve type\"); /* substitute a standard profile */ }","preventionTips":["Validate 'para' tag type codes (0–5) before conversion.","Re-export suspect profiles with Photoshop/littleCMS.","Avoid profiles from unverified download sites."],"tags":["icc","color-management","profile-validation","csharp"],"backgroundTag":"invalid-enum-value","analyzedSha":"59ce6af6fc29027cda277ef62d4d1694a8acce91","analyzedAt":"2026-09-13T18:34:59.331Z","contentChangedAt":"2026-09-13T18:34:59.331Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}