OpenImageIO icon indicating copy to clipboard operation
OpenImageIO copied to clipboard

Feature request: add STDIN command input to oiiotool

Open hhm0 opened this issue 11 years ago • 3 comments

It would be great to be able to give commands to oiiotool via STDIN (on supporting platforms), in addition to providing commands as command line parameters. This way, oiiotool can be used interactively, and can take a series of commands larger than the command line length-limit.

This can either be enabled by using things like isatty http://pubs.opengroup.org/onlinepubs/9699919799/functions/isatty.html on POSIX, or by a command line flag. The question remains, how to combine the commands from the params and from STDIN: either only allow one of these to be used at the same time; or execute the commands from one, first (I suppose the params first, since STDIN length is often effectively unlimited.

A nice/easy way to code this, would be to lex STDIN, and then have a class or functions which simulate the command line processing functions (maybe just splitting on spaces, and on quotes if needed), but taking input from STDIN instead. This way the code requires minimal change.

hhm0 avatar Jul 28 '13 09:07 hhm0

+1 for the general idea, especially in light of troubles dealing with image sequences (#684); spawning hundreds of subprocesses on Windows to loop over long image lists add a lot of overhead that would be eliminated by simply passing command lines to a single oiiotool process.

That being said, I could probably make better use of Python bindings to the oiiotool entry points (ie. actions). This would eliminate the subprocess trouble altogether.

bgagnon avatar Oct 08 '13 17:10 bgagnon

I'm very very close to submitting a pull request for Python bindings for all of ImageBufAlgo. Stay tuned, I hope to have this ready for review in the next several days. Hopefully the weekend will afford me the time to get it ready to submit.

lgritz avatar Oct 09 '13 18:10 lgritz

The Python bindings have really been beefed up lately, including Python support for nearly all the ImageBufAlgo functions that make up the heavy lifting of oiiotool. I wonder how much that is a better solution for you than making oiiotool have an interactive command mode.

lgritz avatar Nov 10 '13 22:11 lgritz

I don't discount the idea of allowing oiiotool to, basically, be able to read command line arguments from stdin. In fact, it's a rather neato idea. I'd be happy for somebody to pick it up. But since nobody has for 10 years (nor have people been beating down the door asking for it), I'm going to close to declutter the issue list.

Anybody reading who is sad about this and wants to implement it should feel free to re-open or just submit a PR that makes it work.

lgritz avatar Feb 14 '24 00:02 lgritz