AcademySoftwareFoundation / AcademySoftwareFoundation/OpenImageIO

Docs are unclear/incomplete about how to preserve unassociated alpha

Open
#3,313 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.4k
Forks
698
Avg merge
3d 9h
Merged PRs (30d)
48

Description

### Discussed in https://github.com/OpenImageIO/oiio/discussions/3271

Originally posted by **jreichel-nvidia** January 12, 2022
I've a couple of questions about associated/unassociated alpha. I'm aware of the general explanations in #3267.

1. The supports() method does not seem to recognize "oiio:UnassociatedAlpha" at all except for the null plugin. So there seems to be no programmatic way to detect whether a plugin supports "oiio:UnassociatedAlpha" and I have to figure that out from the code or the documentation.
2. There is a mismatch between code and the documentation. Maybe I'm missing something, but PNG export seems to support "oiio:UnassociatedAlpha" whereas the documentation does not mention it. Same for PSD input, TGA input/output, JPEG-2000 output.
3. The code snippet in the tutorial part of the documentation suggests to check the value of "oiio:UnassociatedAlpha" e.g. after read_image(), suggesting that import operations might set it back to 0 if it was non-zero. Is that possible? If yes, it might be worth pointing that out in the documentation.
4. (Related to the previous question.) For formats that support both cases, e.g. for TIFF, the documentation about the "else" case could be clearer: Quote: "If nonzero, and the file contains unassociated alpha, this will cause the reader to leave alpha unassociated [...]." What if the option is nonzero and the file contains associated alpha? Will alpha be converted to unassociated then or will the request be ignored? (The attribute documented further down seems to provide a way to figure that out, but at least a reference might be useful.)
5. I have/need data with unassociated alpha. I can do the conversion on my own data structures if need be, but is it possibly to convert from/to associated alpha during import/export using OIIO functionality (possibly highly optimized)? Does this require a detour via ImageBuf, or it possible to do that directly with the read/write methods on ImageInput/ImageOutput?
6. I guess the answer is "no" but just for completeness: Is there a way to switch the OIIO API to unassociated alpha and let OIIO do the necessary conversions under the hood (if necessary)? Just dreaming ... ;-)

Contributor guide

Open the contributing guide

Research direction

Review discussion #3271 and issue #3267 first, then trace the documented supports(), read_image(), ImageInput/ImageOutput, and ImageBuf behavior. Compare the documentation with the PNG, PSD, TGA, JPEG-2000, and TIFF cases listed here. Done means the docs accurately explain support detection, import/export conversion semantics, and the associated/unassociated-alpha cases raised.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.