Prerequisites
ImageSharp version
3.1.5
Other ImageSharp packages and versions
3.1.5
Environment (Operating system, version and so on)
Windows
.NET Framework version
.NET 8.0
Description
I was developing a new JPEG-LS (lossless jpeg) codec interop for ImageSharp as the build-in decoder doesn't support it.
I noticed a couple of issues during this development that I like to share. For easy tracking I have a separate report for each issue:
Every valid JPEG file starts with a SOI marker. The JpegImageFormatDetector.cs checks this but also checks if there is a Jfif application segment present or an Exif segment. These 2 checks are redundant as files with an Jfif or Exif segment will also start with a SOI marker.
|
&& (IsJfif(header) || IsExif(header) || IsJpeg(header)); |
Steps to Reproduce
N.A. checks are valid, just not really needed.
Images
No response
Prerequisites
DEBUGandRELEASEmodeImageSharp version
3.1.5
Other ImageSharp packages and versions
3.1.5
Environment (Operating system, version and so on)
Windows
.NET Framework version
.NET 8.0
Description
I was developing a new JPEG-LS (lossless jpeg) codec interop for ImageSharp as the build-in decoder doesn't support it.
I noticed a couple of issues during this development that I like to share. For easy tracking I have a separate report for each issue:
Every valid JPEG file starts with a SOI marker. The JpegImageFormatDetector.cs checks this but also checks if there is a Jfif application segment present or an Exif segment. These 2 checks are redundant as files with an Jfif or Exif segment will also start with a SOI marker.
ImageSharp/src/ImageSharp/Formats/Jpeg/JpegImageFormatDetector.cs
Line 25 in 4584377
Steps to Reproduce
N.A. checks are valid, just not really needed.
Images
No response