/ping @sciecode
Thanks for pinging @mrdoob.
I'll take a look at it to figure out what might be happening.
So, OpenEXR defines header attribute called preview which is supposed to represent a "thumbnail" version of full image. This was my first time checking a file with it, so thanks for letting me about it. Now, we don't have any use for this attribute internally, so I was mostly thinking about just skipping it during header parsing.
After that, I was able to correctly decode and read the file. So I don't believe there are any other problems with the PIZ compression itself, just with the fact that we never implemented how to deal with preview optional.
I'll be pushing a quickfix PR, just so that EXR files with preview don't hard fail.
Oh, you are right. I am very sorry for that. When I tried to skip the "preview" attribute, I forgot to increase the offset.value by "size" (so it was still crashing).
If an unknown attribute is found, maybe just skip it and print it in the console, that it is unknown, instead of throwing an error.
If an unknown attribute is found, maybe just skip it and print it in the console, that it is unknown, instead of throwing an error.
Unfortunately we can't know the size of an unknown attribute, so its not possible to auto skip. But 'preview' appears to be the last attribute not yet specified, so we shouldn't have any other problems after this fix.
Each attribute in an EXR header stores its size, so you can skip unknown attributes. See https://www.openexr.com/documentation/openexrfilelayout.pdf
Each header is a sequence of attributes ended by a null byte.
The layout of an attribute is as follows:
attribute name
attribute type
attribute size
attribute value
It is in your code on a line 2022 :)
var attributeSize = parseUint32( bufferDataView, offset );
You are correct! It is possible just skip unknown attributes, I was looking just inside parseValues.
In that case, I think that is probably the best workaround. I'll change #20108 to reflect this, instead.
Most helpful comment
Each attribute in an EXR header stores its size, so you can skip unknown attributes. See https://www.openexr.com/documentation/openexrfilelayout.pdf
Each header is a sequence of attributes ended by a null byte.
The layout of an attribute is as follows:
attribute name
attribute type
attribute size
attribute value