Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(raw): fix LibRaw flip to Exif orientation conversion (AcademySoft…
…wareFoundation#3847) When reading a raw image while having a `user_flip` set to 1, we set the orientation Exif tag to LibRaw's flip value (so that LibRaw doesn't rotate and/or mirror the buffer but the image still gets displayed correctly). However LibRaw's convention for flip values differ from Exif orientation values: https://www.libraw.org/comment/5176#comment-5176. In this PR we fix this issue by converting LibRaw flip values to Exif orientation values. This conversion is based on: - https://www.libraw.org/comment/5178#comment-5178 (conversion proposed by LibRaw's maintainer) - https://github.com/LibRaw/LibRaw/blob/6fffd414bfda63dfef2276ae07f7ca36660b8888/src/write/file_write.cpp#L22 (LibRaw's function for applying the flip). Tested on: - CR2 images with flip values 1, 5 and 6 - ARW images with flip values 1 and 5 (unfortunately I could not find any image covering other flip values). Since the conversion is `[1, 2, 3, 4, 5, 6, 7, 8] -> [1, 2, 4, 3, 5, 8, 6, 7]`, the only test that came out with different results before and after the change is the one with flip value 6: in that case, the image orientation got corrected by the fix.
- Loading branch information