Sorry for the delay. I wanted to give a simple answer, but in double checking I 
realized that it doesn't actually work.

On the C++ side, we just set the "ICCProfile" attribute as a uint8 array (with 
length the size of the blob that holds the ICC profile). So you'd think that in 
Python, it would be the same thing:

    b = bytes([ ...  ])    # somehow you have a byte array
    spec = oiio.ImageSpec(...)
    spec.attribute("ICCProfile", "uint8[{}]".format(len(b)), b)

But unfortunately, the ability to set and retrieve attributes that are 
arbitrary uint8 arrays requires this patch (which is now under review, not yet 
merged, but I'll get it in the patch release scheduled for April 1): 

https://github.com/OpenImageIO/oiio/pull/3378 
<https://github.com/OpenImageIO/oiio/pull/3378>



> On Mar 11, 2022, at 10:25 AM, Martin Sebastian Senn <baesti.s...@gmx.ch> 
> wrote:
> 
> Good morning!
> 
> Is it possible to set the ICCProfile attribute of a loaded image using the 
> Python API? If so a small code exampe would be super helpful. Assuming I read 
> the profile’s .icc file into a byte array, how would I pass this to the image 
> spec's attribute setter?
> 
> Thank you so much!
> - Martin

--
Larry Gritz
l...@larrygritz.com




_______________________________________________
Oiio-dev mailing list
Oiio-dev@lists.openimageio.org
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to