From 4e84800728b7cdd8196b9d887091456c0a0ccc98 Mon Sep 17 00:00:00 2001 From: Brian Popow Date: Mon, 23 May 2022 14:54:19 +0200 Subject: [PATCH] Fallback to id color deduction for adobe marker --- src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs b/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs index 84a679620c..99039567ae 100644 --- a/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs +++ b/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs @@ -533,6 +533,12 @@ namespace SixLabors.ImageSharp.Formats.Jpeg return JpegColorSpace.RGB; } + // Fallback to the id color deduction: If these values are 1-3 for a 3-channel image, then the image is assumed to be YCbCr. + if (this.Components[2].Id == 3 && this.Components[1].Id == 2 && this.Components[0].Id == 1) + { + return JpegColorSpace.YCbCr; + } + JpegThrowHelper.ThrowNotSupportedColorSpace(); }