Closed tiagoshibata closed 7 years ago
openexrpython currently breaks with channels using subsampling (eg. images with chroma subsampling, such as EXR's Y RY BY encoding).
Run the following in openexr-images:
#!/bin/env python2 import OpenEXR import pprint filename = 'Chromaticities/Rec709_YC.exr' assert OpenEXR.isOpenExrFile(filename) exr_file = OpenEXR.InputFile(filename) assert exr_file.isComplete() pprint.pprint(exr_file.header()) exr_file.channel('RY')
Result:
{'channels': {'BY': HALF (2, 2), 'RY': HALF (2, 2), 'Y': HALF (1, 1)}, 'compression': PIZ_COMPRESSION, 'dataWindow': (0, 0) - (609, 405), 'displayWindow': (0, 0) - (609, 405), 'lineOrder': INCREASING_Y, 'owner': 'Copyright 2006 Industrial Light & Magic', 'pixelAspectRatio': 1.0, 'screenWindowCenter': (0.0, 0.0), 'screenWindowWidth': 1.0} Traceback (most recent call last): File "./crash.py", line 10, in <module> exr_file.channel('RY') IOError: X and/or y subsampling factors of "RY" channel of input file "Chromaticities/Rec709_YC.exr" are not compatible with the frame buffer's subsampling factors.
Subsampling rate should be adjusted in this code instead of hardcoded to 1. Some more fixes are required for writing files.
I will do a pull request with the required fixes.
openexrpython currently breaks with channels using subsampling (eg. images with chroma subsampling, such as EXR's Y RY BY encoding).
How to reproduce
Run the following in openexr-images:
Result:
Fix
Subsampling rate should be adjusted in this code instead of hardcoded to 1. Some more fixes are required for writing files.
I will do a pull request with the required fixes.