-
Notifications
You must be signed in to change notification settings - Fork 562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(oiiotool): don't propagate unsupported channels #3838
Merged
lgritz
merged 1 commit into
AcademySoftwareFoundation:master
from
lgritz:lg-pngnonalpha
May 14, 2023
Merged
fix(oiiotool): don't propagate unsupported channels #3838
lgritz
merged 1 commit into
AcademySoftwareFoundation:master
from
lgritz:lg-pngnonalpha
May 14, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fixes 3837 oiiotool already attempted to trim extra channels when outputting to a format that can't support it. It correctly handled the two common cases: * More than 4 channels for formats that don't have `supports("nchannels")` will drop after the first 4 channels. * More than 3 channels for formats that don't have `supports("alpha")` will drop after the first 3 channels. But this omits an interesting (but rare) corner case: a 4 channel file where the last channel is NOT alpha, and the output file supports an alpha channel but not arbitrary channels. A concrete example might be an input file that is exr with channels R, G, B, Z, writing to a PNG file (which can support RGB or RGBA). We wouldn't want to write what appears to be an RGBA file if that last channel isn't really alpha. Also, noticed that oiiotool --chnames didn't properly clear the alpha_channel and z_channel flags, which is important if the new channel lists drop one of those channels.
lgritz
merged commit May 14, 2023
dce61b3
into
AcademySoftwareFoundation:master
19 of 20 checks passed
lgritz
added a commit
to lgritz/OpenImageIO
that referenced
this pull request
May 15, 2023
…oundation#3838) Fixes AcademySoftwareFoundation#3837 oiiotool already attempted to trim extra channels when outputting to a format that can't support it. It correctly handled the two common cases: * More than 4 channels for formats that don't have `supports("nchannels")` will drop after the first 4 channels. * More than 3 channels for formats that don't have `supports("alpha")` will drop after the first 3 channels. But this omits an interesting (but rare) corner case: a 4 channel file where the last channel is NOT alpha, and the output file supports an alpha channel but not arbitrary channels. A concrete example might be an input file that is exr with channels R, G, B, Z, writing to a PNG file (which can support RGB or RGBA). We wouldn't want to write what appears to be an RGBA file if that last channel isn't really alpha. Also, noticed that oiiotool --chnames didn't properly clear the alpha_channel and z_channel flags, which is important if the new channel lists drop one of those channels.
lgritz
added a commit
to lgritz/OpenImageIO
that referenced
this pull request
Jun 7, 2023
…oundation#3838) Fixes AcademySoftwareFoundation#3837 oiiotool already attempted to trim extra channels when outputting to a format that can't support it. It correctly handled the two common cases: * More than 4 channels for formats that don't have `supports("nchannels")` will drop after the first 4 channels. * More than 3 channels for formats that don't have `supports("alpha")` will drop after the first 3 channels. But this omits an interesting (but rare) corner case: a 4 channel file where the last channel is NOT alpha, and the output file supports an alpha channel but not arbitrary channels. A concrete example might be an input file that is exr with channels R, G, B, Z, writing to a PNG file (which can support RGB or RGBA). We wouldn't want to write what appears to be an RGBA file if that last channel isn't really alpha. Also, noticed that oiiotool --chnames didn't properly clear the alpha_channel and z_channel flags, which is important if the new channel lists drop one of those channels.
lgritz
added a commit
to imageworks/OpenImageIO
that referenced
this pull request
Jun 7, 2023
…oundation#3838) Fixes AcademySoftwareFoundation#3837 oiiotool already attempted to trim extra channels when outputting to a format that can't support it. It correctly handled the two common cases: * More than 4 channels for formats that don't have `supports("nchannels")` will drop after the first 4 channels. * More than 3 channels for formats that don't have `supports("alpha")` will drop after the first 3 channels. But this omits an interesting (but rare) corner case: a 4 channel file where the last channel is NOT alpha, and the output file supports an alpha channel but not arbitrary channels. A concrete example might be an input file that is exr with channels R, G, B, Z, writing to a PNG file (which can support RGB or RGBA). We wouldn't want to write what appears to be an RGBA file if that last channel isn't really alpha. Also, noticed that oiiotool --chnames didn't properly clear the alpha_channel and z_channel flags, which is important if the new channel lists drop one of those channels.
birsoyo
pushed a commit
to birsoyo/oiio
that referenced
this pull request
Jun 8, 2023
…oundation#3838) Fixes AcademySoftwareFoundation#3837 oiiotool already attempted to trim extra channels when outputting to a format that can't support it. It correctly handled the two common cases: * More than 4 channels for formats that don't have `supports("nchannels")` will drop after the first 4 channels. * More than 3 channels for formats that don't have `supports("alpha")` will drop after the first 3 channels. But this omits an interesting (but rare) corner case: a 4 channel file where the last channel is NOT alpha, and the output file supports an alpha channel but not arbitrary channels. A concrete example might be an input file that is exr with channels R, G, B, Z, writing to a PNG file (which can support RGB or RGBA). We wouldn't want to write what appears to be an RGBA file if that last channel isn't really alpha. Also, noticed that oiiotool --chnames didn't properly clear the alpha_channel and z_channel flags, which is important if the new channel lists drop one of those channels.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #3837
oiiotool already attempted to trim extra channels when outputting to a format that can't support it. It correctly handled the two common cases:
supports("nchannels")
will drop after the first 4 channels.supports("alpha")
will drop after the first 3 channels.But this omits an interesting (but rare) corner case: a 4 channel file where the last channel is NOT alpha, and the output file supports an alpha channel but not arbitrary channels. A concrete example might be an input file that is exr with channels R, G, B, Z, writing to a PNG file (which can support RGB or RGBA). We wouldn't want to write what appears to be an RGBA file if that last channel isn't really alpha.
Also, noticed that oiiotool --chnames didn't properly clear the alpha_channel and z_channel flags, which is important if the new channel lists drop one of those channels.