Errors with HDR output using imageio

I have been compiling ART myself on Kubuntu 22.04 (and other versions of Ubuntu) for a long time. Today I added OpenColorIO and I git cloned the ART imageio repo. I ran the “pip” command to install Python dependencies such as pillow_heif. I used apt to install the Ubuntu supplied python3-tifffile DEB package. I copied the imageio Python scripts/data to $HOME/.config/ART1.0/imageio and ran the new ART. I attempt to output a HDR image using “HEIC (PQ HDR-TV 1000nits)” as the file format in ART. So far so good. Then I get an error writing the file. I ran strace to trace what ART is doing to create the file and I see this is run by ART from the $HOME/.config/ART1.0/imageio directory (ART creates a pipe to the below command so ART is able to read the stdout and stderr of the process):

“python hif/ -m write -p 1000 /tmp/input.tif DSC_2879.heic”.

To help me trouble shoot I use ART to generate a 32bit float TIFF image and run that python stuff from a terminal and I get this:

tompkinj@zjct1:~/.config/ART1.0/imageio> python hif/ -m write -p 1000 ~/DSC_2879.tif ~/DSC_2879.heic
loading: 0.008 s
encoding: 0.009 s
saving: 0.004 s
Traceback (most recent call last):
File “/home/tompkinj/.config/ART1.0/imageio/hif/”, line 324, in
File “/home/tompkinj/.config/ART1.0/imageio/hif/”, line 318, in main
File “/home/tompkinj/.config/ART1.0/imageio/hif/”, line 312, in write, quality=80)
File “/home/tompkinj/.local/lib/python3.10/site-packages/pillow_heif/”, line 685, in save
self._save(heif_ctx_write, images_to_save, primary_index, **kwargs)
File “/home/tompkinj/.config/ART1.0/imageio/hif/”, line 285, in my_save
File “/home/tompkinj/.local/lib/python3.10/site-packages/pillow_heif/”, line 164, in set_color_profile
v = nclx_profile.get(i, None)
AttributeError: ‘bytes’ object has no attribute ‘get’

The above is the same error output (on file descriptor 2 which is stderr piped to ART) as I see when running the strace on the actual ART command so I think the above replicates the issue.

Problem is I know very little about Python so I don’t know how to debug any further. Anyone have ideas on how to fix “AttributeError: ‘bytes’ object has no attribute ‘get’” ? Its probably something I did wrong in setting it all up.

Thanks for the report. Can you share also the tiff file? Are you using the latest version of ART-imageio? (Just double checking on this).

One more question: what version of pillow_heif are you using?

Ok, so it seems pillow_heif 0.9.1 changed the way nclx profiles are handled (see pillow_heif/ at master · bigcat88/pillow_heif · GitHub). Should be fixed now in the latest main of ART-imageio. Thanks for reporting!

Here is the AboutThisBuild.txt for the ART I compiled:

Version: 1.18.0
Branch: 1.18.0
Commit: d09dede65
Commit date: 2023-01-02
Compiler: cc 11.2.0
Processor: x86_64
System: Linux
Bit depth: 64 bits
Gtkmm: 3.24.5
Exiv2: 0.27.3
LCMS2: 2.12
LibRaw: 0.21.0-Snapshot202110
OpenColorIO: 2.3.0
Build type: release
Build flags: -std=c++11 -ffp-contract=off -march=native -Werror=unused-label -fno-math-errno -Wall -Wuninitialized -Wno-deprecated-declarations -Wno>
Link flags: -march=native
OpenMP support: ON
Mi-malloc: V2.0
Build OS: Linux
Build date: 2023-01-05T00:36:26Z

“pip list” shows I am using:

pillow-heif 0.9.1

I got your updated and it works now. Thanks!