Browse Source

Another attempt to get deducing jpeg color space right

pull/2124/head
Brian Popow 4 years ago
parent
commit
535372da09
  1. 9
      src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs

9
src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs

@ -524,9 +524,8 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
return JpegColorSpace.RGB;
}
if (this.hasJFif)
if (!this.adobe.Equals(default) && this.adobe.ColorTransform == JpegConstants.Adobe.ColorTransformYCbCr)
{
// JFIF implies YCbCr.
return JpegColorSpace.YCbCr;
}
@ -537,6 +536,12 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
return JpegColorSpace.RGB;
}
if (this.hasJFif)
{
// JFIF implies YCbCr.
return JpegColorSpace.YCbCr;
}
// 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)
{

Loading…
Cancel
Save