2021.01.15 16:38 "[Tiff] Issue reading .CR2 files (OJPEG) in libtiff ver 4.0.10", by Agnish Dutta
I'm a developer at MathWorks working on Image formats. One of our customers reported an issue with reading a .CR2 raw image file (Roda.CR2) in the version of our software which uses the 4.0.10 version of the libtiff library. He said that he sees an all green image when he decodes the file and that this wasn't the case in an earlier version of our software (which used libtiff 4.0.0).
To verify if the issue is with the library I created a standalone file (main.cpp) and build it with the 4.0.10 version of the library to decode the attached Roda.CR2 file and store the cdata in a binary file (viewable in any online binary file editor) and saw that it indeed was the case that the Red and Blue channels had all 0's and the Green channel had all 135's. I used the same code with the 4.0.0 version but this time the image was decoded fine.
How one can reproduce the issue:
- Find the relevant files in this link<https://drive.google.com/drive/folders/1iiyegp71SCYNF3iKldvnF8f6nI75k3al?usp=sharing>.
- Make sure that the main.cpp and Roda.CR2 file are in the same directory.
- Build the main.cpp file with the 4.0.10 version of the libtiff library.
- Run the executable.
- Open the binary file generated by the code in: https://hexed.it/
- You should be able to see a series of 0's followed by 87's (base 16) followed by several 0's again, indicating that the R and B channels are 0's and the G channel is at 135.
- OS: PRETTY_NAME="Debian GNU/Linux 10 (buster)" NAME="Debian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)" VERSION_CODENAME=buster ID=Debian
- Kernel: 4.19.0-13-amd64 #1</libtiff/libtiff/-/issues/1> SMP Debian 4.19.160-2
- Compiler: g++ (Debian 8.3.0-6) 8.3.0
- ii g++ 4:8.3.0-1 amd64 GNU C++ compiler ii g++-8 8.3.0-6 amd64 GNU C++ compiler
I was wondering if this is a known issue or not. I found the following link which is about a bug somewhat similar in nature to the one we've encountered:
If this is indeed a known bug then could you kindly also mention what's planned for it?