The PIL.ImageFilter Module

BLUR (class) [#]

Blur filter.

For more information about this class, see The BLUR Class.

CONTOUR (class) [#]

Contour filter.

For more information about this class, see The CONTOUR Class.

DETAIL (class) [#]

Detail filter.

For more information about this class, see The DETAIL Class.

EDGE_ENHANCE (class) [#]

Edge enhancement filter.

For more information about this class, see The EDGE_ENHANCE Class.

EDGE_ENHANCE_MORE (class) [#]

Stronger edge enhancement filter.

For more information about this class, see The EDGE_ENHANCE_MORE Class.

EMBOSS (class) [#]

Embossing filter.

For more information about this class, see The EMBOSS Class.

FIND_EDGES (class) [#]

Edge-finding filter.

For more information about this class, see The FIND_EDGES Class.

Kernel(size, kernel, **options) (class) [#]

Convolution filter kernel.

For more information about this class, see The Kernel Class.

MaxFilter(size=3) (class) [#]

Max filter.

For more information about this class, see The MaxFilter Class.

MedianFilter(size=3) (class) [#]

Median filter.

For more information about this class, see The MedianFilter Class.

MinFilter(size=3) (class) [#]

Min filter.

For more information about this class, see The MinFilter Class.

ModeFilter(size=3) (class) [#]

Mode filter.

For more information about this class, see The ModeFilter Class.

RankFilter(size, rank) (class) [#]

Rank filter.

For more information about this class, see The RankFilter Class.

SHARPEN (class) [#]

Sharpening filter.

For more information about this class, see The SHARPEN Class.

SMOOTH (class) [#]

Smoothing filter.

For more information about this class, see The SMOOTH Class.

SMOOTH_MORE (class) [#]

Stronger smoothing filter.

For more information about this class, see The SMOOTH_MORE Class.

The BLUR Class

BLUR (class) [#]

Blur filter.

The CONTOUR Class

CONTOUR (class) [#]

Contour filter.

The DETAIL Class

DETAIL (class) [#]

Detail filter.

The EDGE_ENHANCE Class

EDGE_ENHANCE (class) [#]

Edge enhancement filter.

The EDGE_ENHANCE_MORE Class

EDGE_ENHANCE_MORE (class) [#]

Stronger edge enhancement filter.

The EMBOSS Class

EMBOSS (class) [#]

Embossing filter.

The FIND_EDGES Class

FIND_EDGES (class) [#]

Edge-finding filter.

The Kernel Class

Kernel(size, kernel, **options) (class) [#]

Convolution filter kernel.

__init__(size, kernel, **options) [#]

Create a convolution kernel. The current version only supports 3x3 and 5x5 integer and floating point kernels.

In the current version, kernels can only be applied to "L" and "RGB" images.

size
Kernel size, given as (width, height). In the current version, this must be (3,3) or (5,5).
kernel
A sequence containing kernel weights.
**options
Optional keyword arguments.
scale=
Scale factor. If given, the result for each pixel is divided by this value. The default is the sum of the kernel weights.
offset=
Offset. If given, this value is added to the result, after it has been divided by the scale factor.

The MaxFilter Class

MaxFilter(size=3) (class) [#]

Max filter. Picks the largest pixel value in a window with the given size.

__init__(size=3) [#]

Create a max filter.

size
The kernel size, in pixels.

The MedianFilter Class

MedianFilter(size=3) (class) [#]

Median filter. Picks the median pixel value in a window with the given size.

__init__(size=3) [#]

Create a median filter.

size
The kernel size, in pixels.

The MinFilter Class

MinFilter(size=3) (class) [#]

Min filter. Picks the lowest pixel value in a window with the given size.

__init__(size=3) [#]

Create a min filter.

size
The kernel size, in pixels.

The ModeFilter Class

ModeFilter(size=3) (class) [#]

Mode filter. Picks the most frequent pixel value in a box with the given size. Pixel values that occur only once or twice are ignored; if no pixel value occurs more than twice, the original pixel value is preserved.

__init__(size=3) [#]

Create a mode filter.

size
The kernel size, in pixels.

The RankFilter Class

RankFilter(size, rank) (class) [#]

Rank filter.

__init__(size, rank) [#]

Create a rank filter. The rank filter sorts all pixels in a window of the given size, and returns the rank'th value.

size
The kernel size, in pixels.
rank
What pixel value to pick. Use 0 for a min filter, size*size/2 for a median filter, size*size-1 for a max filter, etc.

The SHARPEN Class

SHARPEN (class) [#]

Sharpening filter.

The SMOOTH Class

SMOOTH (class) [#]

Smoothing filter.

The SMOOTH_MORE Class

SMOOTH_MORE (class) [#]

Stronger smoothing filter.