Hello, I've been messing around with the python binding and struggling to understand how to consistently deal with different image formats. The python examples in the repo and on the webpage appear to always create an array with the "B" flag filled with empty bit. This appears to only provide meaningful results when dealing with 8 bit images.
I've attached a 4x1 exr that I've been experimenting with. The values look correct when I set the array to float. Does this mean that I need to examine the bit depth of the images and map them to the available array types? I thought that might be an aspect of image IO that OpenImageIO would abstract away. Also how would I deal with an exr containing channels of different bit depths? The messy function I have bellow is what I've been using to experiment. Thanks in advance for any assistance you all can offer. import os import array import numpy import OpenImageIO as oiio searchpath = os.getenv("LD_LIBRARY_PATH") def openImage(path): inImage = oiio.ImageInput.create("exr",searchpath) spec = oiio.ImageSpec() inImage.open(path,spec) print "type", spec.format.basetype print "size", spec.format.basesize() data = array.array("f", "\0" * spec.image_bytes(True)) inImage.read_image(spec.format, data) print "Data len, ", len(data) print "image bytes" , spec.image_bytes(True) print "w, h, c", spec.width,spec.height,spec.nchannels print spec.width*spec.height*spec.nchannels for i in range(0,len(data)): print data[i] -- Jesse Vander Does 401-226-8251 | jvanderd...@gmail.com
4pxGrad.exr
Description: Binary data
_______________________________________________ Oiio-dev mailing list Oiio-dev@lists.openimageio.org http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org