Skip to content

Commit 4d0fb40

Browse files
committed
Put setting JpegColorType and ColorSpace close together
1 parent d844e70 commit 4d0fb40

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -912,6 +912,7 @@ private void ProcessStartOfFrameMarker(BufferedReadStream stream, int remaining,
912912
this.Frame.MaxHorizontalFactor = maxH;
913913
this.Frame.MaxVerticalFactor = maxV;
914914
this.ColorSpace = this.DeduceJpegColorSpace();
915+
this.Metadata.GetJpegMetadata().ColorType = this.ColorSpace == JpegColorSpace.Grayscale ? JpegColorType.Luminance : JpegColorType.YCbCr;
915916
this.Frame.InitComponents();
916917
this.ImageSizeInMCU = new Size(this.Frame.McusPerLine, this.Frame.McusPerColumn);
917918
}
@@ -1038,8 +1039,6 @@ private void ProcessStartOfScanMarker(BufferedReadStream stream, CancellationTok
10381039
this.Frame.ComponentOrder[i] = (byte)componentIndex;
10391040
}
10401041

1041-
this.Metadata.GetJpegMetadata().ColorType = (selectorsCount == 1) ? JpegColorType.Luminance : JpegColorType.YCbCr;
1042-
10431042
stream.Read(this.temp, 0, 3);
10441043

10451044
int spectralStart = this.temp[0];

0 commit comments

Comments
 (0)