Color transform unpremult logic changes. #1864
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After some deep thinking and discussion with people who know more color
than me, I have become convinced that you almost always want to make
sure to un-premultiply colors (i.e. divide by alpha) before doing color
space transformations with OCIO, and then re-multiply by alpha (to get
back to "associated alpha") immediately after the color transformation.
To support this,
For the ImageBufAlgo color transformation functions, change the default
value of the
unpremult
parameter fromfalse
totrue
.oiiotool --colorconvert
and the various--ocio
commands willalso default to doing the unpremult/premult steps, unless a new optional
modifier is used:
:unpremult=0
.oiiotool --autocc
will do the unpremult/premult steps surrounding anyautomatic color transformations that it does upon input and output.
On the whole, I think this makes the situation less error prone for
casual users. Most oiiotool command lines should just use --autocc and
then not need to worry about any explicit use of
--colorconvert
or--unpremult/--premult
. For the rare case when more control is needed,the individual commands and modifiers can be used.
Note that for oiiotool,
--autocc
is not on by default. If you wantimages auto-converted to linear space and ouputs auto-converted from
linear to the desired output space, you need to use
--autocc
.