# Module PIL.ImageFilter

#### Module Summary:

    class BLUR:
        def __init__(self)

> Blur filter.

    class CONTOUR:
        def __init__(self)

> Contour filter.

    class DETAIL:
        def __init__(self)

> Detail filter.

    class EDGE_ENHANCE:
        def __init__(self)

> Edge enhancement filter.

    class EDGE_ENHANCE_MORE:
        def __init__(self)

> Stronger edge enhancement filter.

    class EMBOSS:
        def __init__(self)

> Embossing filter.

    class FIND_EDGES:
        def __init__(self)

> Edge-finding filter.

    class Kernel:
        def __init__(self, size, kernel, **options)

> Convolution filter kernel.

    class MaxFilter:
        def __init__(self, size=3)

> Max filter.

    class MedianFilter:
        def __init__(self, size=3)

> Median filter.

    class MinFilter:
        def __init__(self, size=3)

> Min filter.

    class ModeFilter:
        def __init__(self, size=3)

> Mode filter.

    class RankFilter:
        def __init__(self, size, rank)

> Rank filter.

    class SHARPEN:
        def __init__(self)

> Sharpening filter.

    class SMOOTH:
        def __init__(self)

> Smoothing filter.

    class SMOOTH_MORE:
        def __init__(self)

> Stronger smoothing filter.

## Classes

### The BLUR Class

    BLUR()

Blur filter.

### The CONTOUR Class

    CONTOUR()

Contour filter.

### The DETAIL Class

    DETAIL()

Detail filter.

### The EDGE_ENHANCE Class

    EDGE_ENHANCE()

Edge enhancement filter.

### The EDGE_ENHANCE_MORE Class

    EDGE_ENHANCE_MORE()

Stronger edge enhancement filter.

### The EMBOSS Class

    EMBOSS()

Embossing filter.

### The FIND_EDGES Class

    FIND_EDGES()

Edge-finding filter.

### The Kernel Class

    Kernel()

Convolution filter kernel.

#### Constructor:

    Kernel(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.

#### Parameters:

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

#### Keyword Parameters:

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

#### Method Summary:

### The MaxFilter Class

    MaxFilter()

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

#### Constructor:

    MaxFilter(size=3)

Create a max filter.

#### Parameters:

`size` -- The kernel size, in pixels.

#### Method Summary:

### The MedianFilter Class

    MedianFilter()

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

#### Constructor:

    MedianFilter(size=3)

Create a median filter.

#### Parameters:

`size` -- The kernel size, in pixels.

#### Method Summary:

### The MinFilter Class

    MinFilter()

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

#### Constructor:

    MinFilter(size=3)

Create a min filter.

#### Parameters:

`size` -- The kernel size, in pixels.

#### Method Summary:

### The ModeFilter Class

    ModeFilter()

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.

#### Constructor:

    ModeFilter(size=3)

Create a mode filter.

#### Parameters:

`size` -- The kernel size, in pixels.

#### Method Summary:

### The RankFilter Class

    RankFilter()

Rank filter.

#### Constructor:

    RankFilter(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.

#### Parameters:

`size` -- The kernel size, in pixels.

`rank` -- What pixel value to pick. Use 0 for a min filter, size/2 for a median filter, size-1 for a max filter, etc.

#### Method Summary:

### The SHARPEN Class

    SHARPEN()

Sharpening filter.

### The SMOOTH Class

    SMOOTH()

Smoothing filter.

### The SMOOTH_MORE Class

    SMOOTH_MORE()

Stronger smoothing filter.