Open am11 opened 9 months ago
As I'm sure you are aware. CR2 files are raw files that use the Tiff format internally.
The reference you highlighted is just some metadata in the jpg file indicating the raw file it originated from. We don't have dedicated CR2 decoders nor encoders.
However.... We can actually open the file if we remove the sanitation check and treat the default SOI offset as zero. However, we parse the dimensions of the file as defined in the IFD0 marker as 5184x3456 (The image is rotated 90degrees CW for display) not as described by Windows as 5202x3464
I think we are doing the correct thing here by only decoding the valid pixels but that's open to interpretation. Would that behaviour be expected by you?
@JimBobSquarePants, thank you for the update. I think having the CR2 encoder/decoder (derived from TIFF?) would be a good fit for ImageSharp library. Compliance with standard, instead of Windows behavior, makes sense to me as well. File explorer example was just a reference point where this format is supported.
Prerequisites
DEBUG
andRELEASE
modeImageSharp version
3.1.2
Other ImageSharp packages and versions
-
Environment (Operating system, version and so on)
Windows 11 amd64
.NET Framework version
.NET 8.0
Description
In a project, I have test assets with a CR2 image
Berries.CR2.zip
which windows file explorer provides the preview for:
However, loading this image with ImageSharp fails:
I couldn't find much information whether or not Canon's CR2 support is deliberately left out. https://github.com/SixLabors/ImageSharp/blob/1f22bceef8bb79793cbdcc26ace38a726ad9b8c8/tests/Images/Input/Jpg/baseline/JpegSnoopReports/Lake.jpg.txt#L162 suggests it might not be intentional. Opening this issue just in case. :)
Steps to Reproduce
Images
Berries.CR2.zip