diff --git a/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs b/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs index f7cc82c7d..8571cf0ec 100644 --- a/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs +++ b/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs @@ -912,6 +912,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg this.Frame.MaxHorizontalFactor = maxH; this.Frame.MaxVerticalFactor = maxV; this.ColorSpace = this.DeduceJpegColorSpace(); + this.Metadata.GetJpegMetadata().ColorType = this.ColorSpace == JpegColorSpace.Grayscale ? JpegColorType.Luminance : JpegColorType.YCbCr; this.Frame.InitComponents(); this.ImageSizeInMCU = new Size(this.Frame.McusPerLine, this.Frame.McusPerColumn); } @@ -1038,8 +1039,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg this.Frame.ComponentOrder[i] = (byte)componentIndex; } - this.Metadata.GetJpegMetadata().ColorType = (selectorsCount == 1) ? JpegColorType.Luminance : JpegColorType.YCbCr; - stream.Read(this.temp, 0, 3); int spectralStart = this.temp[0];