pythonware.com ::: library ::: Python Imaging Library Handbook (2003 Edition) |
The ImageMath module can be used to evaluate "image expressions". The module provides a single eval function, which takes an expression string and one or more images.
This module is only available in the PIL Plus package.
eval(expression, environment) => image or value
Evaluate the expression in the given environment, and return the result. The result can be either an image or a single value (integer, float, or pixel tuple).
Expressions are standard Python expressions, but they're evaluated in a non-standard environment. You can use PIL methods as usual, plus the following set of operators and functions: