2013-10-13 03:49:32 +04:00
|
|
|
.. py:module:: PIL.ImageFilter
|
|
|
|
.. py:currentmodule:: PIL.ImageFilter
|
|
|
|
|
2020-06-22 06:52:50 +03:00
|
|
|
:py:mod:`~PIL.ImageFilter` Module
|
|
|
|
=================================
|
2013-10-13 03:49:32 +04:00
|
|
|
|
2020-06-22 06:52:50 +03:00
|
|
|
The :py:mod:`~PIL.ImageFilter` module contains definitions for a pre-defined set of
|
2013-10-13 04:14:12 +04:00
|
|
|
filters, which can be be used with the :py:meth:`Image.filter()
|
|
|
|
<PIL.Image.Image.filter>` method.
|
2013-10-13 03:49:32 +04:00
|
|
|
|
2013-10-13 04:14:12 +04:00
|
|
|
Example: Filter an image
|
|
|
|
------------------------
|
2013-10-13 03:49:32 +04:00
|
|
|
|
2023-02-24 00:17:10 +03:00
|
|
|
::
|
2013-10-13 03:49:32 +04:00
|
|
|
|
2013-10-13 04:14:12 +04:00
|
|
|
from PIL import ImageFilter
|
2013-10-13 03:49:32 +04:00
|
|
|
|
|
|
|
im1 = im.filter(ImageFilter.BLUR)
|
|
|
|
|
|
|
|
im2 = im.filter(ImageFilter.MinFilter(3))
|
|
|
|
im3 = im.filter(ImageFilter.MinFilter) # same as MinFilter(3)
|
|
|
|
|
|
|
|
Filters
|
|
|
|
-------
|
|
|
|
|
2024-03-25 22:00:03 +03:00
|
|
|
Pillow provides the following set of predefined image enhancement filters:
|
2013-10-13 03:49:32 +04:00
|
|
|
|
|
|
|
* **BLUR**
|
|
|
|
* **CONTOUR**
|
|
|
|
* **DETAIL**
|
|
|
|
* **EDGE_ENHANCE**
|
|
|
|
* **EDGE_ENHANCE_MORE**
|
|
|
|
* **EMBOSS**
|
|
|
|
* **FIND_EDGES**
|
2018-01-30 12:13:51 +03:00
|
|
|
* **SHARPEN**
|
2013-10-13 03:49:32 +04:00
|
|
|
* **SMOOTH**
|
|
|
|
* **SMOOTH_MORE**
|
|
|
|
|
2018-04-11 13:36:48 +03:00
|
|
|
.. autoclass:: PIL.ImageFilter.Color3DLUT
|
2019-04-21 16:28:08 +03:00
|
|
|
:members:
|
|
|
|
|
2017-09-14 01:59:25 +03:00
|
|
|
.. autoclass:: PIL.ImageFilter.BoxBlur
|
2019-04-21 16:28:08 +03:00
|
|
|
:members:
|
|
|
|
|
2018-04-11 13:36:48 +03:00
|
|
|
.. autoclass:: PIL.ImageFilter.GaussianBlur
|
2019-04-21 16:28:08 +03:00
|
|
|
:members:
|
|
|
|
|
2018-04-12 12:20:59 +03:00
|
|
|
.. autoclass:: PIL.ImageFilter.UnsharpMask
|
2019-04-21 16:28:08 +03:00
|
|
|
:members:
|
|
|
|
|
2013-10-13 03:49:32 +04:00
|
|
|
.. autoclass:: PIL.ImageFilter.Kernel
|
2019-04-21 16:28:08 +03:00
|
|
|
:members:
|
|
|
|
|
2018-04-12 12:20:59 +03:00
|
|
|
.. autoclass:: PIL.ImageFilter.RankFilter
|
2019-04-21 16:28:08 +03:00
|
|
|
:members:
|
|
|
|
|
2013-10-13 03:49:32 +04:00
|
|
|
.. autoclass:: PIL.ImageFilter.MedianFilter
|
2019-04-21 16:28:08 +03:00
|
|
|
:members:
|
|
|
|
|
2013-10-13 03:49:32 +04:00
|
|
|
.. autoclass:: PIL.ImageFilter.MinFilter
|
2019-04-21 16:28:08 +03:00
|
|
|
:members:
|
|
|
|
|
2013-10-13 03:49:32 +04:00
|
|
|
.. autoclass:: PIL.ImageFilter.MaxFilter
|
2019-04-21 16:28:08 +03:00
|
|
|
:members:
|
|
|
|
|
2013-10-13 03:49:32 +04:00
|
|
|
.. autoclass:: PIL.ImageFilter.ModeFilter
|
2019-04-21 16:28:08 +03:00
|
|
|
:members:
|
2020-07-09 21:23:19 +03:00
|
|
|
|
|
|
|
.. class:: Filter
|
|
|
|
|
|
|
|
An abstract mixin used for filtering images
|
2020-07-10 16:16:04 +03:00
|
|
|
(for use with :py:meth:`~PIL.Image.Image.filter`).
|
2020-07-09 21:23:19 +03:00
|
|
|
|
|
|
|
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
|
2020-07-10 16:16:04 +03:00
|
|
|
(for use with :py:meth:`~PIL.Image.Image.filter`).
|
2020-07-09 21:23:19 +03:00
|
|
|
|
|
|
|
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.
|