Hello,
I have another issue. I'm reading an exr file, and the result is not
expected.
Code:
import OpenImageIO as oiio
import os, array
file_dir = 'C:\Users\digi\Pictures\inspiration'
image_path = os.path.join(file_dir, 'test.exr')
image_input = oiio.ImageInput.create(image_path)
image = image_input.open(image_path)
spec = image.spec()
data = array.array('d', '\0' * spec.image_bytes(True))
image.read_image(spec.format, data)
for channel in range(len(data)):
print(data[channel])
Result:
print: 5.9578290394e-39
On Mon, Mar 11, 2013 at 7:46 PM, Christoph Gohlke <[email protected]> wrote:
> Hi Scott,
>
> There are some scripts at <https://github.com/**
> OpenImageIO/oiio/tree/master/**src/python<https://github.com/OpenImageIO/oiio/tree/master/src/python>>
> but they seem outdated. The "Python Bindings" chapter in the documentation <
> https://github.com/**OpenImageIO/oiio/blob/RB-1.1/**
> src/doc/openimageio.pdf<https://github.com/OpenImageIO/oiio/blob/RB-1.1/src/doc/openimageio.pdf>>
> is empty. For now it's probably best to follow the C++ API and/or read the
> source code of the Python bindings.
>
> Christoph
>
>
>
> On 3/11/2013 7:16 PM, Scott Wilson wrote:
>
>> Hi Chris,
>>
>> Looks like it works. Thanks! Is there any more examples or documentation
>> on the Python bindings?
>>
>> Regards,
>> Scott Wilson
>>
>>
>> On Mon, Mar 11, 2013 at 6:55 PM, Christoph Gohlke <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>> Hi,
>>
>> I think the API recently changed. This works for me:
>>
>> import OpenImageIO as oiio
>> image_input = oiio.ImageInput.create('jpg', '')
>> image = image_input.open('oiio-images.**
>> __git\\tahoe-gps.jpg')
>>
>> spec = image.spec()
>> print image, spec.width, spec.height
>>
>> <OpenImageIO.ImageInput object at 0x00000000029AE7B8> 2048 1536
>>
>> --
>> Christoph
>>
>>
>>
>> Hello,
>>
>> The following code is throwing me the following error while
>> running:
>>
>> import OpenImageIO as oiio
>> import os
>>
>> oiio_path = 'C:\Python27\Lib\site-__**packages'
>> file_dir = 'C:\Users\scott\Pictures\__**inspiration\characters'
>>
>> ext = 'jpg'
>> image_path = os.path.join(file_dir, '000g1kzq.jpg')
>>
>> image_input = oiio.ImageInput.create(ext, oiio_path)
>> spec = oiio.ImageSpec()
>>
>> result = image_input.open(image_path, spec)
>> print(result)
>>
>> I get the following traceback:
>> Traceback (most recent call last):
>> File "C:/Users/scott/Desktop/oiio__**_test.py", line 12, in
>>
>> <module>
>> result = image_input.open(image_path, spec)
>> ArgumentError: Python argument types in
>> ImageInput.open(str, ImageSpec)
>> did not match C++ signature:
>> open(class std::basic_string<char,struct
>> std::char_traits<char>,class
>> std::allocator<char> > filename)
>>
>> I'm using OpenImageIO 1.1.6 64 bit for Python 2.7 compiled here:
>>
>> http://www.lfd.uci.edu/~__**gohlke/pythonlibs/#openimageio<http://www.lfd.uci.edu/~__gohlke/pythonlibs/#openimageio>
>>
>> <http://www.lfd.uci.edu/%**7Egohlke/pythonlibs/#**openimageio<http://www.lfd.uci.edu/%7Egohlke/pythonlibs/#openimageio>
>> >
>>
>>
>> If anyone could let me know if I am doing anything wrong, that
>> would be
>> extremely appreciated. Thanks.
>>
>> ______________________________**___________________
>> Oiio-dev mailing list
>> [email protected] <mailto:Oiio-dev@lists.**
>> openimageio.org <[email protected]>>
>> http://lists.openimageio.org/_**_listinfo.cgi/oiio-dev-__**
>> openimageio.org<http://lists.openimageio.org/__listinfo.cgi/oiio-dev-__openimageio.org>
>> <http://lists.openimageio.org/**listinfo.cgi/oiio-dev-**
>> openimageio.org<http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org>
>> >
>>
>>
>>
>>
>>
>> ______________________________**_________________
>> Oiio-dev mailing list
>> [email protected]
>> http://lists.openimageio.org/**listinfo.cgi/oiio-dev-**openimageio.org<http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org>
>>
>> ______________________________**_________________
> Oiio-dev mailing list
> [email protected]
> http://lists.openimageio.org/**listinfo.cgi/oiio-dev-**openimageio.org<http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org>
>
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org