PR that proposing implementing the new expression: https://github.com/OpenImageIO/oiio/pull/3822 <https://github.com/OpenImageIO/oiio/pull/3822>
> On Apr 25, 2023, at 1:16 PM, Larry Gritz <[email protected]> wrote: > > That's a very good point, and I think you have highlighted that it would be > very helpful to have something in the expression syntax that expands to the > number of items currently on the stack, so you could do (just picking a name > arbitrarily): > > oiiotool multipart.exr --sisplit --while "{NIMAGES}" ...commands... --pop > --endwhile > > I'll put that on my list, unless somebody else would like to try tackling it > (it shouldn't be hard at all, look in oiiotool.cpp for the line `// Test some > special identifiers` in Oiiotool::express_parse_atom()). > > If you really are dealing specifically with the case iterating the subimages > of one file, I think you could do this now: > > oiiotool --for s "{IMG[input.exr].'oiio:subimages'}" input.exr --subimage > "{s}" -o "sub.{s}.exr" --endfor > > ??? > > So this iterates by subimage index, for each one re-specifies the input and > pulls out the indexed subimage. > I just did a -o to output the subimage, but of course you could do any > processing you want. > > You're still kind of limited by how complex a command line you want to make, > so if that "per subimage" logic includes more decisions depending on what it > finds, in the end you may just find it unwieldy and perhaps a better solution > is to use the OpenImageio.ImageBuf kind of approach inside a small python > script? > > > >> On Apr 25, 2023, at 12:35 PM, Matt Chaput <[email protected] >> <mailto:[email protected]>> wrote: >> >> I want use `oiiotool` to apply certain processing to, and then output, every >> subimage (AOV) in an EXR file. >> >> The -a option works for some things (like resizing each subimage), and I can >> use `-sisplit` to get the subimages on the stack, then write them all to >> disk with `-o:all=1`. But there doesn't seem to be a way to apply general >> processing to each image on the stack, where some operations will have an >> expression that should evaluated for each image. >> >> What I can't seem to figure out, or maybe is missing, is a way to do the >> equivalent of: >> >> FOREACH image on the stack: >> ...process... >> >> or alternatively: >> >> WHILE stack size > 0: >> ...process... >> POP >> >> (What I want to do is resize every subimage, and for certain subimages >> (1-channel monochrome images), turn it into a heatmap... so I need to apply >> a "pipeline" involving stuff like --if, --subc {TOP.MINCOLOR}, --colormap, >> etc. etc. to each subimage. I would also like name the output files based on >> each subimage's "name" info.) >> >> Maybe the answer is to write out the subimages and then process them >> separately, but for performance reasons it would be nice to do it all in one >> call to `oiiotool`. >> >> My current idea for a workaround is two separate calls: one get the names of >> all the subimages, and then I build a very long `oiiotool` command line with >> args that extract, process, and output each named subimage separately. >> >> Anyone know a better way? >> >> Thanks, >> >> Matt >> >> >> _______________________________________________ >> Oiio-dev mailing list >> [email protected] <mailto:[email protected]> >> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org >> > > -- > Larry Gritz > [email protected] <mailto:[email protected]> > > > > > > _______________________________________________ > Oiio-dev mailing list > [email protected] > http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org -- Larry Gritz [email protected]
_______________________________________________ Oiio-dev mailing list [email protected] http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
