Nathan, Thanks for the PDF link to the OpenEXR file layout - I was looking for something like that!
Rich On May 22, 2012, at 1:23 PM, Nathan Rusch wrote: > The compression attribute will be in a different place within the header > depending on the number of channels in the file (due to the layout of the EXR > header). > > Adrian's snippet is simply finding the 'compression' attribute name within > the header, since that is one of the standard EXR attributes. From there, > based on known information about the EXR file layout, he can determine where > the actual compression attribute value is stored. > > The read size of 1024 is pretty much an arbitrary value; you may need to read > a larger chunk in order to get far enough into the file to locate the > compression attribute if your file has a lot of channels. If you know the > names of all the channels within the file, you could figure out exactly how > many bytes to read, or even start your read from a predefined offset to keep > your data buffer as small as possible; otherwise, you'll just need to make a > safe estimate. > > Check out this doc for a nice simple example of the structure of an EXR file: > http://www.openexr.com/openexrfilelayout.pdf > > Hope this helps. > > -Nathan > > > -----Original Message----- From: Dan Rosen > Sent: Tuesday, May 22, 2012 9:59 AM > To: Nuke user discussion > Subject: Re: [Nuke-users] How to check zip compression type for EXR images...? > > This is great! Can you let us know what index number the datatype is > in? I'm finding it hard to tell. > > thx > Dan > > On Mon, May 21, 2012 at 7:30 PM, Richard Bobo <[email protected]> wrote: >> Adrian, >> >> Brilliant - I'll be making it into a nice little pulldown menu utility >> function! And, looking a bit deeper at your code, of course, so I can learn >> some more Python... 8^) >> >> Thanks! >> >> Rich >> >> Rich Bobo >> Senior VFX Compositor >> >> Mobile: (248) 840-2665 >> Web: http://richbobo.com/ >> >> "Man has been endowed with reason, with the power to create, so that he can >> add to what he's been given." >> - Anton Chekhov >> >> >> >> On May 21, 2012, at 6:40 PM, Adrian Baltowski wrote: >> >> Hi >> With just few lines of code and totally simplified >> >> ********************************** >> compList = ['None', 'RLE', 'ZIP', 'ZIP 16 lines', 'PIZ', 'PXR24', 'B44', >> 'B44A'] >> >> n = nuke.selectedNode() >> file = nuke.filename(n, nuke.REPLACE) >> fd = open(file, 'rb') >> header = fd.read(1024) >> index = header.find('compression') >> comp =ord(header[(index+28):(index+29)]) >> print compList[comp] >> >> *********************************** >> >> Each exr file MUST have compression info in the header and this info is >> placed just after channels info. It's simple to get actual size of channels >> list but I quickly set 1024 bytes of a headroom. >> >> Best >> Adrian > > _______________________________________________ > Nuke-users mailing list > [email protected], http://forums.thefoundry.co.uk/ > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users _______________________________________________ Nuke-users mailing list [email protected], http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
