pythonware.com ::: library ::: Python Imaging Library Handbook (2003 Edition)

Back   Next

On this page:
Examples
Functions
Expression Syntax

The ImageMath Module (PIL Plus)

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.

Examples

Functions

eval

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).

Expression Syntax

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:

Operators

Built-in Functions

Back   Next