[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Openexr-devel] Header Size?
From: |
Florian Kainz |
Subject: |
Re: [Openexr-devel] Header Size? |
Date: |
Wed, 10 Mar 2010 11:32:04 -0800 |
User-agent: |
Thunderbird 2.0.0.23 (X11/20090821) |
Hi Yanko,
the OpenEXR file header is an arbitrarily long sequence of
"attributes", followed by a single null byte. An attribute
never begins with a null. This allows you to parse the file
header incrementally: keep reading attributes until you find
one that appears to begin with a null byte.
Are you sure you have to write an OpenEXR file parser in
Python? Python modules that read and write OpenEXR files
using ILM's C++ library are available online, for example
at http://excamera.com/sphinx/articles-openexr.html.
Florian
Yanko Sanchez wrote:
I'm trying to read exr's using python's struct module. This is my first
time reading binary files and the PDF at the openexr has been very
helpful but I am a little puzzled on how to figure out what is the
header size with its 'optional' attributes... For example, nuke includes
a nuke hashstring but photoshop doesn't... before getting to the
hashstring I don't think I can tell if the file came form nuke or
photoshop... and if someone used their own plugin to create the EXR then
the header might also contain other data that might throw of my reader.
Is there a way to know where the header ends so I can skip all those
bytes and just go straight to the offset of scanlines and pixel data?
According to the docs there is a null byte at the end of the header, but
there are lots of null bytes at the end of a lot of attributes. Is there
a common way to dealing with this?
Once I get through the header I am able to read a float uncompressed
scanline EXR file and display the data using matplotlib successfully.
Any help would be appreciated!
Yanko
------------------------------------------------------------------------
_______________________________________________
Openexr-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/openexr-devel