1
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
4
<meta http-equiv='Content-Type' content='text/html; charset=us-ascii' />
5
<title>The PIL.ImageFilter Module</title>
6
<link rel='stylesheet' href='effbot.css' type='text/css' />
9
<h1>The PIL.ImageFilter Module</h1>
11
<dt><b>BLUR</b> (class) [<a href='#PIL.ImageFilter.BLUR-class'>#</a>]</dt>
14
<p>For more information about this class, see <a href='#PIL.ImageFilter.BLUR-class'><i>The BLUR Class</i></a>.</p>
16
<dt><b>CONTOUR</b> (class) [<a href='#PIL.ImageFilter.CONTOUR-class'>#</a>]</dt>
18
<p>Contour filter.</p>
19
<p>For more information about this class, see <a href='#PIL.ImageFilter.CONTOUR-class'><i>The CONTOUR Class</i></a>.</p>
21
<dt><b>DETAIL</b> (class) [<a href='#PIL.ImageFilter.DETAIL-class'>#</a>]</dt>
24
<p>For more information about this class, see <a href='#PIL.ImageFilter.DETAIL-class'><i>The DETAIL Class</i></a>.</p>
26
<dt><b>EDGE_ENHANCE</b> (class) [<a href='#PIL.ImageFilter.EDGE_ENHANCE-class'>#</a>]</dt>
28
<p>Edge enhancement filter.</p>
29
<p>For more information about this class, see <a href='#PIL.ImageFilter.EDGE_ENHANCE-class'><i>The EDGE_ENHANCE Class</i></a>.</p>
31
<dt><b>EDGE_ENHANCE_MORE</b> (class) [<a href='#PIL.ImageFilter.EDGE_ENHANCE_MORE-class'>#</a>]</dt>
33
<p>Stronger edge enhancement filter.</p>
34
<p>For more information about this class, see <a href='#PIL.ImageFilter.EDGE_ENHANCE_MORE-class'><i>The EDGE_ENHANCE_MORE Class</i></a>.</p>
36
<dt><b>EMBOSS</b> (class) [<a href='#PIL.ImageFilter.EMBOSS-class'>#</a>]</dt>
38
<p>Embossing filter.</p>
39
<p>For more information about this class, see <a href='#PIL.ImageFilter.EMBOSS-class'><i>The EMBOSS Class</i></a>.</p>
41
<dt><b>FIND_EDGES</b> (class) [<a href='#PIL.ImageFilter.FIND_EDGES-class'>#</a>]</dt>
43
<p>Edge-finding filter.</p>
44
<p>For more information about this class, see <a href='#PIL.ImageFilter.FIND_EDGES-class'><i>The FIND_EDGES Class</i></a>.</p>
46
<dt><b>Kernel(size, kernel, **options)</b> (class) [<a href='#PIL.ImageFilter.Kernel-class'>#</a>]</dt>
48
<p>Convolution filter kernel.</p>
49
<p>For more information about this class, see <a href='#PIL.ImageFilter.Kernel-class'><i>The Kernel Class</i></a>.</p>
51
<dt><b>MaxFilter(size=3)</b> (class) [<a href='#PIL.ImageFilter.MaxFilter-class'>#</a>]</dt>
54
<p>For more information about this class, see <a href='#PIL.ImageFilter.MaxFilter-class'><i>The MaxFilter Class</i></a>.</p>
56
<dt><b>MedianFilter(size=3)</b> (class) [<a href='#PIL.ImageFilter.MedianFilter-class'>#</a>]</dt>
59
<p>For more information about this class, see <a href='#PIL.ImageFilter.MedianFilter-class'><i>The MedianFilter Class</i></a>.</p>
61
<dt><b>MinFilter(size=3)</b> (class) [<a href='#PIL.ImageFilter.MinFilter-class'>#</a>]</dt>
64
<p>For more information about this class, see <a href='#PIL.ImageFilter.MinFilter-class'><i>The MinFilter Class</i></a>.</p>
66
<dt><b>ModeFilter(size=3)</b> (class) [<a href='#PIL.ImageFilter.ModeFilter-class'>#</a>]</dt>
69
<p>For more information about this class, see <a href='#PIL.ImageFilter.ModeFilter-class'><i>The ModeFilter Class</i></a>.</p>
71
<dt><b>RankFilter(size, rank)</b> (class) [<a href='#PIL.ImageFilter.RankFilter-class'>#</a>]</dt>
74
<p>For more information about this class, see <a href='#PIL.ImageFilter.RankFilter-class'><i>The RankFilter Class</i></a>.</p>
76
<dt><b>SHARPEN</b> (class) [<a href='#PIL.ImageFilter.SHARPEN-class'>#</a>]</dt>
78
<p>Sharpening filter.</p>
79
<p>For more information about this class, see <a href='#PIL.ImageFilter.SHARPEN-class'><i>The SHARPEN Class</i></a>.</p>
81
<dt><b>SMOOTH</b> (class) [<a href='#PIL.ImageFilter.SMOOTH-class'>#</a>]</dt>
83
<p>Smoothing filter.</p>
84
<p>For more information about this class, see <a href='#PIL.ImageFilter.SMOOTH-class'><i>The SMOOTH Class</i></a>.</p>
86
<dt><b>SMOOTH_MORE</b> (class) [<a href='#PIL.ImageFilter.SMOOTH_MORE-class'>#</a>]</dt>
88
<p>Stronger smoothing filter.</p>
89
<p>For more information about this class, see <a href='#PIL.ImageFilter.SMOOTH_MORE-class'><i>The SMOOTH_MORE Class</i></a>.</p>
92
<h2><a id='PIL.ImageFilter.BLUR-class' name='PIL.ImageFilter.BLUR-class'>The BLUR Class</a></h2>
94
<dt><b>BLUR</b> (class) [<a href='#PIL.ImageFilter.BLUR-class'>#</a>]</dt>
99
<h2><a id='PIL.ImageFilter.CONTOUR-class' name='PIL.ImageFilter.CONTOUR-class'>The CONTOUR Class</a></h2>
101
<dt><b>CONTOUR</b> (class) [<a href='#PIL.ImageFilter.CONTOUR-class'>#</a>]</dt>
103
<p>Contour filter.</p>
106
<h2><a id='PIL.ImageFilter.DETAIL-class' name='PIL.ImageFilter.DETAIL-class'>The DETAIL Class</a></h2>
108
<dt><b>DETAIL</b> (class) [<a href='#PIL.ImageFilter.DETAIL-class'>#</a>]</dt>
110
<p>Detail filter.</p>
113
<h2><a id='PIL.ImageFilter.EDGE_ENHANCE-class' name='PIL.ImageFilter.EDGE_ENHANCE-class'>The EDGE_ENHANCE Class</a></h2>
115
<dt><b>EDGE_ENHANCE</b> (class) [<a href='#PIL.ImageFilter.EDGE_ENHANCE-class'>#</a>]</dt>
117
<p>Edge enhancement filter.</p>
120
<h2><a id='PIL.ImageFilter.EDGE_ENHANCE_MORE-class' name='PIL.ImageFilter.EDGE_ENHANCE_MORE-class'>The EDGE_ENHANCE_MORE Class</a></h2>
122
<dt><b>EDGE_ENHANCE_MORE</b> (class) [<a href='#PIL.ImageFilter.EDGE_ENHANCE_MORE-class'>#</a>]</dt>
124
<p>Stronger edge enhancement filter.</p>
127
<h2><a id='PIL.ImageFilter.EMBOSS-class' name='PIL.ImageFilter.EMBOSS-class'>The EMBOSS Class</a></h2>
129
<dt><b>EMBOSS</b> (class) [<a href='#PIL.ImageFilter.EMBOSS-class'>#</a>]</dt>
131
<p>Embossing filter.</p>
134
<h2><a id='PIL.ImageFilter.FIND_EDGES-class' name='PIL.ImageFilter.FIND_EDGES-class'>The FIND_EDGES Class</a></h2>
136
<dt><b>FIND_EDGES</b> (class) [<a href='#PIL.ImageFilter.FIND_EDGES-class'>#</a>]</dt>
138
<p>Edge-finding filter.</p>
141
<h2><a id='PIL.ImageFilter.Kernel-class' name='PIL.ImageFilter.Kernel-class'>The Kernel Class</a></h2>
143
<dt><b>Kernel(size, kernel, **options)</b> (class) [<a href='#PIL.ImageFilter.Kernel-class'>#</a>]</dt>
145
<p>Convolution filter kernel.</p>
147
<dt><a id='PIL.ImageFilter.Kernel.__init__-method' name='PIL.ImageFilter.Kernel.__init__-method'><b>__init__(size, kernel, **options)</b></a> [<a href='#PIL.ImageFilter.Kernel.__init__-method'>#</a>]</dt>
149
<p>Create a convolution kernel. The current version only
150
supports 3x3 and 5x5 integer and floating point kernels.
152
In the current version, kernels can only be applied to
153
"L" and "RGB" images.
158
Kernel size, given as (width, height). In
159
the current version, this must be (3,3) or (5,5).</dd>
160
<dt><i>kernel</i></dt>
162
A sequence containing kernel weights.</dd>
163
<dt><i>**options</i></dt>
165
Optional keyword arguments.</dd>
166
<dt><i>scale=</i></dt>
168
Scale factor. If given, the result for each
169
pixel is divided by this value. The default is the sum
170
of the kernel weights.</dd>
171
<dt><i>offset=</i></dt>
173
Offset. If given, this value is added to the
174
result, after it has been divided by the scale factor.</dd>
178
<h2><a id='PIL.ImageFilter.MaxFilter-class' name='PIL.ImageFilter.MaxFilter-class'>The MaxFilter Class</a></h2>
180
<dt><b>MaxFilter(size=3)</b> (class) [<a href='#PIL.ImageFilter.MaxFilter-class'>#</a>]</dt>
182
<p>Max filter. Picks the largest pixel value in a window with the
185
<dt><a id='PIL.ImageFilter.MaxFilter.__init__-method' name='PIL.ImageFilter.MaxFilter.__init__-method'><b>__init__(size=3)</b></a> [<a href='#PIL.ImageFilter.MaxFilter.__init__-method'>#</a>]</dt>
187
<p>Create a max filter.</p>
191
The kernel size, in pixels.</dd>
195
<h2><a id='PIL.ImageFilter.MedianFilter-class' name='PIL.ImageFilter.MedianFilter-class'>The MedianFilter Class</a></h2>
197
<dt><b>MedianFilter(size=3)</b> (class) [<a href='#PIL.ImageFilter.MedianFilter-class'>#</a>]</dt>
199
<p>Median filter. Picks the median pixel value in a window with the
202
<dt><a id='PIL.ImageFilter.MedianFilter.__init__-method' name='PIL.ImageFilter.MedianFilter.__init__-method'><b>__init__(size=3)</b></a> [<a href='#PIL.ImageFilter.MedianFilter.__init__-method'>#</a>]</dt>
204
<p>Create a median filter.</p>
208
The kernel size, in pixels.</dd>
212
<h2><a id='PIL.ImageFilter.MinFilter-class' name='PIL.ImageFilter.MinFilter-class'>The MinFilter Class</a></h2>
214
<dt><b>MinFilter(size=3)</b> (class) [<a href='#PIL.ImageFilter.MinFilter-class'>#</a>]</dt>
216
<p>Min filter. Picks the lowest pixel value in a window with the given
219
<dt><a id='PIL.ImageFilter.MinFilter.__init__-method' name='PIL.ImageFilter.MinFilter.__init__-method'><b>__init__(size=3)</b></a> [<a href='#PIL.ImageFilter.MinFilter.__init__-method'>#</a>]</dt>
221
<p>Create a min filter.</p>
225
The kernel size, in pixels.</dd>
229
<h2><a id='PIL.ImageFilter.ModeFilter-class' name='PIL.ImageFilter.ModeFilter-class'>The ModeFilter Class</a></h2>
231
<dt><b>ModeFilter(size=3)</b> (class) [<a href='#PIL.ImageFilter.ModeFilter-class'>#</a>]</dt>
233
<p>Mode filter. Picks the most frequent pixel value in a box with the
234
given size. Pixel values that occur only once or twice are ignored;
235
if no pixel value occurs more than twice, the original pixel value
238
<dt><a id='PIL.ImageFilter.ModeFilter.__init__-method' name='PIL.ImageFilter.ModeFilter.__init__-method'><b>__init__(size=3)</b></a> [<a href='#PIL.ImageFilter.ModeFilter.__init__-method'>#</a>]</dt>
240
<p>Create a mode filter.</p>
244
The kernel size, in pixels.</dd>
248
<h2><a id='PIL.ImageFilter.RankFilter-class' name='PIL.ImageFilter.RankFilter-class'>The RankFilter Class</a></h2>
250
<dt><b>RankFilter(size, rank)</b> (class) [<a href='#PIL.ImageFilter.RankFilter-class'>#</a>]</dt>
254
<dt><a id='PIL.ImageFilter.RankFilter.__init__-method' name='PIL.ImageFilter.RankFilter.__init__-method'><b>__init__(size, rank)</b></a> [<a href='#PIL.ImageFilter.RankFilter.__init__-method'>#</a>]</dt>
256
<p>Create a rank filter. The rank filter sorts all pixels in
257
a window of the given size, and returns the rank'th value.</p>
261
The kernel size, in pixels.</dd>
264
What pixel value to pick. Use 0 for a min filter,
265
size*size/2 for a median filter, size*size-1 for a max filter,
270
<h2><a id='PIL.ImageFilter.SHARPEN-class' name='PIL.ImageFilter.SHARPEN-class'>The SHARPEN Class</a></h2>
272
<dt><b>SHARPEN</b> (class) [<a href='#PIL.ImageFilter.SHARPEN-class'>#</a>]</dt>
274
<p>Sharpening filter.</p>
277
<h2><a id='PIL.ImageFilter.SMOOTH-class' name='PIL.ImageFilter.SMOOTH-class'>The SMOOTH Class</a></h2>
279
<dt><b>SMOOTH</b> (class) [<a href='#PIL.ImageFilter.SMOOTH-class'>#</a>]</dt>
281
<p>Smoothing filter.</p>
284
<h2><a id='PIL.ImageFilter.SMOOTH_MORE-class' name='PIL.ImageFilter.SMOOTH_MORE-class'>The SMOOTH_MORE Class</a></h2>
286
<dt><b>SMOOTH_MORE</b> (class) [<a href='#PIL.ImageFilter.SMOOTH_MORE-class'>#</a>]</dt>
288
<p>Stronger smoothing filter.</p>