File: ImageFilter.rst

package info (click to toggle)
pillow 12.0.0-1
  • links: PTS
  • area: main
  • in suites: forky
  • size: 72,636 kB
  • sloc: python: 49,518; ansic: 38,787; makefile: 302; sh: 168; javascript: 85
file content (93 lines) | stat: -rw-r--r-- 2,051 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
.. py:module:: PIL.ImageFilter
.. py:currentmodule:: PIL.ImageFilter

:py:mod:`~PIL.ImageFilter` module
=================================

The :py:mod:`~PIL.ImageFilter` module contains definitions for a pre-defined set of
filters, which can be be used with the :py:meth:`Image.filter()
<PIL.Image.Image.filter>` method.

Example: Filter an image
------------------------

::

    from PIL import ImageFilter

    im1 = im.filter(ImageFilter.BLUR)

    im2 = im.filter(ImageFilter.MinFilter(3))
    im3 = im.filter(ImageFilter.MinFilter)  # same as MinFilter(3)

Filters
-------

Pillow provides the following set of predefined image enhancement filters:

* **BLUR**
* **CONTOUR**
* **DETAIL**
* **EDGE_ENHANCE**
* **EDGE_ENHANCE_MORE**
* **EMBOSS**
* **FIND_EDGES**
* **SHARPEN**
* **SMOOTH**
* **SMOOTH_MORE**

.. autoclass:: PIL.ImageFilter.Color3DLUT
    :members:

.. autoclass:: PIL.ImageFilter.BoxBlur
    :members:

.. autoclass:: PIL.ImageFilter.GaussianBlur
    :members:

.. autoclass:: PIL.ImageFilter.UnsharpMask
    :members:

.. autoclass:: PIL.ImageFilter.Kernel
    :members:

.. autoclass:: PIL.ImageFilter.RankFilter
    :members:

.. autoclass:: PIL.ImageFilter.MedianFilter
    :members:

.. autoclass:: PIL.ImageFilter.MinFilter
    :members:

.. autoclass:: PIL.ImageFilter.MaxFilter
    :members:

.. autoclass:: PIL.ImageFilter.ModeFilter
    :members:

.. class:: Filter

    An abstract mixin used for filtering images
    (for use with :py:meth:`~PIL.Image.Image.filter`).

    Implementors must provide the following method:

    .. method:: filter(self, image)

        Applies a filter to a single-band image, or a single band of an image.

        :returns: A filtered copy of the image.

.. class:: MultibandFilter

    An abstract mixin used for filtering multi-band images
    (for use with :py:meth:`~PIL.Image.Image.filter`).

    Implementors must provide the following method:

    .. method:: filter(self, image)

        Applies a filter to a multi-band image.

        :returns: A filtered copy of the image.