OpenImageIO
OpenImageIO copied to clipboard
[BUG] HEIF from Sony ILCE-7M4 opens incorrectly
Describe the bug Opening a HEIF image produced from a Sony ILCE-7M4 camera opens with the incorrect dimensions and image data tiled incorrectly. Example of image + issue below.
I have tried to update to the latest libheif with same results. I am not familiar enough with the code to know whether the issue lies in how OIIO is calling into libheif or if libheif itself is wrong.
To Reproduce Steps to reproduce the behavior:
- Run
oiiotool "Johannes Klauser - DSC00443.HEIF" -o out.png
- out.png will contain incorrect image data
Expected behavior Dimensions should be correct and image data should not be duplicated.
Evidence Original image (posted with permission from creator): Johannes Klauser - DSC00443.HEIF.zip
Output from oiiotool
, resized for github. Original dimensions 7008x4672 (opposite of original):
Platform information:
- OIIO branch/version: 2.4.11.1
- OS: Mac (likely on Windows too)
- C++ compiler: apple-clang 14.0.0
- Any non-default build flags when you build OIIO:
Interesting. Same issue have Affinity Photo 2. but heif-convert.exe from libHEIF correctly decode this image.
I found another bug with libHeif and will looks deeper into OIIO plugin as soon as HEIF with a RAWs is important for my projects.
I understand the issue. Sony HEIF file have 90 degree rotation, when OIIO open it as horizontal (0 degree) rotated image. Digging deeper
@lgritz I found that the example image stores these extra attributes
oiio:OriginalOrientation : 6
Orientation : 1
and using config["oiio:reorient"] = 0;
trow exception in
HeifInput::read_native_scanline(int subimage, int miplevel, int y, int /*z*/, void* data)
probably due to a mismatch in image width and height.