diff --git a/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs b/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs
index e1e6d5d6e9..1e7f5a92e3 100644
--- a/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs
+++ b/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs
@@ -90,6 +90,11 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
///
private JFifMarker jFif;
+ ///
+ /// Whether the image has a JFIF marker. This is needed to determine, if the colorspace is YCbCr.
+ ///
+ private bool hasJFif;
+
///
/// Contains information about the Adobe marker.
///
@@ -519,7 +524,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
return JpegColorSpace.RGB;
}
- if (!this.jFif.Equals(default))
+ if (this.hasJFif)
{
// JFIF implies YCbCr.
return JpegColorSpace.YCbCr;
@@ -721,6 +726,8 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
/// The remaining bytes in the segment block.
private void ProcessApplicationHeaderMarker(BufferedReadStream stream, int remaining)
{
+ this.hasJFif = true;
+
// We can only decode JFif identifiers.
// Some images contain multiple JFIF markers (Issue 1932) so we check to see
// if it's already been read.