pythonware.com ::: library ::: Python Imaging Library Handbook

# The pildriver Utility

The `pildriver` tool, written by Eric S. Raymond, gives access to most PIL functions from your operating system's command-line interface.

        $ pildriver "program"

An instance of the `PILDriver` class is essentially a software stack machine (Polish-notation interpreter) for sequencing PIL image transformations. The state of the instance is the interpreter stack.

The only method one will normally invoke after initialization is the `execute' method. This takes an argument list of tokens, pushes them onto the instance's stack, and then tries to clear the stack by successive evaluation of PILdriver operators. Any part of the stack not cleaned off persists and is part of the evaluation context for the next call of the execute method.

PILDriver doesn't catch any exceptions, on the theory that these are actually diagnostic information that should be interpreted by the calling code.

When called as a script, the command-line arguments are passed to a PILDriver instance. If there are no command-line arguments, the module runs an interactive interpreter, each line of which is split into space-separated tokens and passed to the execute method.