oiiotool: allow optional subimages modifier for many ops #2582
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.
For a large number of oiiotool commands (anything whose implementation
inherits from the OiiotoolOp class), allow the optional modifier
:subimages=...
to control how the operation applies to differentsubimages (when dealing with multi-subimage images).
Of course, previously, the default is that most commands operate only
on the first subimage, discarding the others. The global
-a
(and formany commands the optional
:allsubimages=1
modifier) cause allsubimages to be preserved and the operation to be performed on all of
them.
This new
subimages=...
allows more fine-grained control byspecifying which subimages will be active, as a comma-separated list
of either numeric indices (starting at 0) or subimage names. The
special string "all" means all subimages (thus
:subimages=all
isequivalent to
:allsubimages=1
). Any subimage number or name precededby a "-" excludes that subimage from the active list. The operation
is performed on only on the active subimages, with excluded subimages
merely being copied from the first input image. The presence of any
subimages
modifier implies that all subimages should be preserved.For example, if a.exr is a "multi-part" OpenEXR image (what OIIO calls
multi-image):
Signed-off-by: Larry Gritz lg@larrygritz.com