Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(tiff): Fix TIFF export with EXIF data and I/O proxy (#4300)
TIFF export with EXIF metadata (e.g. oiio::ColorSpace) creates invalid TIFF files in the presence of an I/O proxy ("TIFF directory is missing required "ImageLength" field"). The reasons is that TIFFSetDirectory() requires to read some of the previously written data, but neither writer_readproc() nor the available proxy implementations support that. Note that TIFF output does not yet use this new scheme for I/O proxy that was used for many other plugins. I think writer_readproc() should not take any shortcuts and just forward the call to the I/O proxy. Is there a reason why IOFile (in write mode) and IOVecOutput do not allow to re-read written data? This looks like an artificial restriction of the underlying resources. An alternative not modifiying these two implementations would be to let the TIFF output use a variant of IOVecOutput that allows re-reading and forward all data at the very end to the passed-in proxy. Is there some policy to add assertions in all methods that are not supposed to be called? This would have helped here a lot to reduce the test case. I did not add an explicit test. I guess the proper way would be to convert TIFF ouput to use the same I/O proxy scheme that is used by many other plugins. Small repro case is attached. [repro.cpp.txt](https://github.com/user-attachments/files/15886829/repro.cpp.txt) --------- Signed-off-by: Joachim Reichel <43646584+jreichel-nvidia@users.noreply.github.com>
- Loading branch information