~ubuntu-branches/ubuntu/wily/python-imaging/wily

« back to all changes in this revision

Viewing changes to docs/pythondoc-PIL.Image.html

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2013-01-31 20:49:20 UTC
  • mfrom: (27.1.1 raring-proposed)
  • Revision ID: package-import@ubuntu.com-20130131204920-b5zshy6vgfvdionl
Tags: 1.1.7+1.7.8-1ubuntu1
Rewrite build dependencies to allow cross builds.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
 
2
<html>
 
3
<head>
 
4
<meta http-equiv='Content-Type' content='text/html; charset=us-ascii' />
 
5
<title>The PIL.Image Module</title>
 
6
<link rel='stylesheet' href='effbot.css' type='text/css' />
 
7
</head>
 
8
<body>
 
9
<h1>The PIL.Image Module</h1>
 
10
<dl>
 
11
<dt><a id='PIL.Image.blend-function' name='PIL.Image.blend-function'><b>blend(im1, im2, alpha)</b></a> [<a href='#PIL.Image.blend-function'>#</a>]</dt>
 
12
<dd>
 
13
<p>Creates a new image by interpolating between two input images, using
 
14
a constant alpha.
 
15
 
 
16
<pre>
 
17
   out = image1 * (1.0 - alpha) + image2 * alpha
 
18
</pre>
 
19
 
 
20
</p><dl>
 
21
<dt><i>im1</i></dt>
 
22
<dd>
 
23
</dd>
 
24
<dt><i>im2</i></dt>
 
25
<dd>
 
26
</dd>
 
27
<dt><i>alpha</i></dt>
 
28
<dd>
 
29
</dd>
 
30
<dt>Returns:</dt>
 
31
<dd>
 
32
</dd>
 
33
</dl><br />
 
34
</dd>
 
35
<dt><a id='PIL.Image.composite-function' name='PIL.Image.composite-function'><b>composite(image1, image2, mask)</b></a> [<a href='#PIL.Image.composite-function'>#</a>]</dt>
 
36
<dd>
 
37
<dl>
 
38
<dt><i>image1</i></dt>
 
39
<dd>
 
40
</dd>
 
41
<dt><i>image2</i></dt>
 
42
<dd>
 
43
</dd>
 
44
<dt><i>mask</i></dt>
 
45
<dd>
 
46
</dd>
 
47
</dl><br />
 
48
</dd>
 
49
<dt><a id='PIL.Image.eval-function' name='PIL.Image.eval-function'><b>eval(image, function)</b></a> [<a href='#PIL.Image.eval-function'>#</a>]</dt>
 
50
<dd>
 
51
<dl>
 
52
<dt><i>image</i></dt>
 
53
<dd>
 
54
</dd>
 
55
<dt><i>function</i></dt>
 
56
<dd>
 
57
</dd>
 
58
<dt>Returns:</dt>
 
59
<dd>
 
60
</dd>
 
61
</dl><br />
 
62
</dd>
 
63
<dt><a id='PIL.Image.frombuffer-function' name='PIL.Image.frombuffer-function'><b>frombuffer(mode, size, data, decoder_name=&quot;raw&quot;, *args)</b></a> [<a href='#PIL.Image.frombuffer-function'>#</a>]</dt>
 
64
<dd>
 
65
<p>(New in 1.1.4) Creates an image memory from pixel data in a string
 
66
or byte buffer.
 
67
</p><p>
 
68
This function is similar to <a class="link" href="#PIL.Image.fromstring-function"><b>fromstring</b></a>, but uses data in
 
69
the byte buffer, where possible.  This means that changes to the
 
70
original buffer object are reflected in this image).  Not all modes
 
71
can share memory; support modes include "L", "RGBX", "RGBA", and
 
72
"CMYK".  For other modes, this function behaves like a corresponding
 
73
call to the <b>fromstring</b> function.
 
74
</p><p>
 
75
Note that this function decodes pixel data only, not entire images.
 
76
If you have an entire image file in a string, wrap it in a
 
77
<b>StringIO</b> object, and use <a class="link" href="#PIL.Image.open-function"><b>open</b></a> to load it.
 
78
 
 
79
</p><dl>
 
80
<dt><i>mode</i></dt>
 
81
<dd>
 
82
</dd>
 
83
<dt><i>size</i></dt>
 
84
<dd>
 
85
</dd>
 
86
<dt><i>data</i></dt>
 
87
<dd>
 
88
</dd>
 
89
<dt><i>decoder_name</i></dt>
 
90
<dd>
 
91
</dd>
 
92
<dt><i>*args</i></dt>
 
93
<dd>
 
94
</dd>
 
95
<dt>Returns:</dt>
 
96
<dd>
 
97
</dd>
 
98
</dl><br />
 
99
</dd>
 
100
<dt><a id='PIL.Image.fromstring-function' name='PIL.Image.fromstring-function'><b>fromstring(mode, size, data, decoder_name=&quot;raw&quot;, *args)</b></a> [<a href='#PIL.Image.fromstring-function'>#</a>]</dt>
 
101
<dd>
 
102
<p>Creates an image memory from pixel data in a string.
 
103
</p><p>
 
104
In its simplest form, this function takes three arguments
 
105
(mode, size, and unpacked pixel data).
 
106
</p><p>
 
107
You can also use any pixel decoder supported by PIL.  For more
 
108
information on available decoders, see the section <a href="pil-decoder.htm"><i>Writing Your Own File Decoder</i></a>.
 
109
</p><p>
 
110
Note that this function decodes pixel data only, not entire images.
 
111
If you have an entire image in a string, wrap it in a
 
112
<b>StringIO</b> object, and use <a class="link" href="#PIL.Image.open-function"><b>open</b></a> to load it.
 
113
 
 
114
</p><dl>
 
115
<dt><i>mode</i></dt>
 
116
<dd>
 
117
</dd>
 
118
<dt><i>size</i></dt>
 
119
<dd>
 
120
</dd>
 
121
<dt><i>data</i></dt>
 
122
<dd>
 
123
</dd>
 
124
<dt><i>decoder_name</i></dt>
 
125
<dd>
 
126
</dd>
 
127
<dt><i>*args</i></dt>
 
128
<dd>
 
129
</dd>
 
130
<dt>Returns:</dt>
 
131
<dd>
 
132
</dd>
 
133
</dl><br />
 
134
</dd>
 
135
<dt><a id='PIL.Image.getmodebandnames-function' name='PIL.Image.getmodebandnames-function'><b>getmodebandnames(mode)</b></a> [<a href='#PIL.Image.getmodebandnames-function'>#</a>]</dt>
 
136
<dd>
 
137
<p>Gets a list of individual band names.  Given a mode, this function
 
138
returns a tuple containing the names of individual bands (use
 
139
<a class="link" href="#PIL.Image.getmodetype-function"><b>getmodetype</b></a> to get the mode used to store each individual
 
140
band.
 
141
 
 
142
</p><dl>
 
143
<dt><i>mode</i></dt>
 
144
<dd>
 
145
</dd>
 
146
<dt>Returns:</dt>
 
147
<dd>
 
148
</dd>
 
149
<dt>Raises <b>KeyError</b>:</dt><dd>
 
150
</dd>
 
151
</dl><br />
 
152
</dd>
 
153
<dt><a id='PIL.Image.getmodebands-function' name='PIL.Image.getmodebands-function'><b>getmodebands(mode)</b></a> [<a href='#PIL.Image.getmodebands-function'>#</a>]</dt>
 
154
<dd>
 
155
<dl>
 
156
<dt><i>mode</i></dt>
 
157
<dd>
 
158
</dd>
 
159
<dt>Returns:</dt>
 
160
<dd>
 
161
</dd>
 
162
<dt>Raises <b>KeyError</b>:</dt><dd>
 
163
</dd>
 
164
</dl><br />
 
165
</dd>
 
166
<dt><a id='PIL.Image.getmodebase-function' name='PIL.Image.getmodebase-function'><b>getmodebase(mode)</b></a> [<a href='#PIL.Image.getmodebase-function'>#</a>]</dt>
 
167
<dd>
 
168
<dl>
 
169
<dt><i>mode</i></dt>
 
170
<dd>
 
171
</dd>
 
172
<dt>Returns:</dt>
 
173
<dd>
 
174
</dd>
 
175
<dt>Raises <b>KeyError</b>:</dt><dd>
 
176
</dd>
 
177
</dl><br />
 
178
</dd>
 
179
<dt><a id='PIL.Image.getmodetype-function' name='PIL.Image.getmodetype-function'><b>getmodetype(mode)</b></a> [<a href='#PIL.Image.getmodetype-function'>#</a>]</dt>
 
180
<dd>
 
181
<dl>
 
182
<dt><i>mode</i></dt>
 
183
<dd>
 
184
</dd>
 
185
<dt>Returns:</dt>
 
186
<dd>
 
187
</dd>
 
188
<dt>Raises <b>KeyError</b>:</dt><dd>
 
189
</dd>
 
190
</dl><br />
 
191
</dd>
 
192
<dt><b>Image()</b> (class) [<a href='#PIL.Image.Image-class'>#</a>]</dt>
 
193
<dd>
 
194
<p>This class represents an image object.</p>
 
195
<p>For more information about this class, see <a href='#PIL.Image.Image-class'><i>The Image Class</i></a>.</p>
 
196
</dd>
 
197
<dt><a id='PIL.Image.init-function' name='PIL.Image.init-function'><b>init()</b></a> [<a href='#PIL.Image.init-function'>#</a>]</dt>
 
198
<dd>
 
199
</dd>
 
200
<dt><a id='PIL.Image.isDirectory-function' name='PIL.Image.isDirectory-function'><b>isDirectory(f)</b></a> [<a href='#PIL.Image.isDirectory-function'>#</a>]</dt>
 
201
<dd>
 
202
</dd>
 
203
<dt><a id='PIL.Image.isImageType-function' name='PIL.Image.isImageType-function'><b>isImageType(t)</b></a> [<a href='#PIL.Image.isImageType-function'>#</a>]</dt>
 
204
<dd>
 
205
</dd>
 
206
<dt><a id='PIL.Image.isStringType-function' name='PIL.Image.isStringType-function'><b>isStringType(t)</b></a> [<a href='#PIL.Image.isStringType-function'>#</a>]</dt>
 
207
<dd>
 
208
</dd>
 
209
<dt><a id='PIL.Image.isTupleType-function' name='PIL.Image.isTupleType-function'><b>isTupleType(t)</b></a> [<a href='#PIL.Image.isTupleType-function'>#</a>]</dt>
 
210
<dd>
 
211
</dd>
 
212
<dt><a id='PIL.Image.merge-function' name='PIL.Image.merge-function'><b>merge(mode, bands)</b></a> [<a href='#PIL.Image.merge-function'>#</a>]</dt>
 
213
<dd>
 
214
<dl>
 
215
<dt><i>mode</i></dt>
 
216
<dd>
 
217
</dd>
 
218
<dt><i>bands</i></dt>
 
219
<dd>
 
220
</dd>
 
221
<dt>Returns:</dt>
 
222
<dd>
 
223
</dd>
 
224
</dl><br />
 
225
</dd>
 
226
<dt><a id='PIL.Image.new-function' name='PIL.Image.new-function'><b>new(mode, size, color=0)</b></a> [<a href='#PIL.Image.new-function'>#</a>]</dt>
 
227
<dd>
 
228
<dl>
 
229
<dt><i>mode</i></dt>
 
230
<dd>
 
231
</dd>
 
232
<dt><i>size</i></dt>
 
233
<dd>
 
234
</dd>
 
235
<dt><i>color</i></dt>
 
236
<dd>
 
237
</dd>
 
238
<dt>Returns:</dt>
 
239
<dd>
 
240
</dd>
 
241
</dl><br />
 
242
</dd>
 
243
<dt><a id='PIL.Image.open-function' name='PIL.Image.open-function'><b>open(file, mode=&quot;r&quot;)</b></a> [<a href='#PIL.Image.open-function'>#</a>]</dt>
 
244
<dd>
 
245
<p>Opens and identifies the given image file.
 
246
</p><p>
 
247
This is a lazy operation; this function identifies the file, but the
 
248
actual image data is not read from the file until you try to process
 
249
the data (or call the <a class="link" href="#PIL.Image.Image.load-method"><b>load</b></a> method).
 
250
 
 
251
</p><dl>
 
252
<dt><i>file</i></dt>
 
253
<dd>
 
254
A filename (string) or a file object.  The file object
 
255
   must implement <b>read</b>, <b>seek</b>, and <b>tell</b> methods,
 
256
   and be opened in binary mode.
 
257
</dd>
 
258
<dt><i>mode</i></dt>
 
259
<dd>
 
260
</dd>
 
261
<dt>Returns:</dt>
 
262
<dd>
 
263
</dd>
 
264
<dt>Raises <b>IOError</b>:</dt><dd>
 
265
</dd>
 
266
</dl><br />
 
267
</dd>
 
268
<dt><a id='PIL.Image.preinit-function' name='PIL.Image.preinit-function'><b>preinit()</b></a> [<a href='#PIL.Image.preinit-function'>#</a>]</dt>
 
269
<dd>
 
270
</dd>
 
271
<dt><a id='PIL.Image.register_extension-function' name='PIL.Image.register_extension-function'><b>register_extension(id, extension)</b></a> [<a href='#PIL.Image.register_extension-function'>#</a>]</dt>
 
272
<dd>
 
273
<dl>
 
274
<dt><i>id</i></dt>
 
275
<dd>
 
276
</dd>
 
277
<dt><i>extension</i></dt>
 
278
<dd>
 
279
</dd>
 
280
</dl><br />
 
281
</dd>
 
282
<dt><a id='PIL.Image.register_mime-function' name='PIL.Image.register_mime-function'><b>register_mime(id, mimetype)</b></a> [<a href='#PIL.Image.register_mime-function'>#</a>]</dt>
 
283
<dd>
 
284
<dl>
 
285
<dt><i>id</i></dt>
 
286
<dd>
 
287
</dd>
 
288
<dt><i>mimetype</i></dt>
 
289
<dd>
 
290
</dd>
 
291
</dl><br />
 
292
</dd>
 
293
<dt><a id='PIL.Image.register_open-function' name='PIL.Image.register_open-function'><b>register_open(id, factory, accept=None)</b></a> [<a href='#PIL.Image.register_open-function'>#</a>]</dt>
 
294
<dd>
 
295
<dl>
 
296
<dt><i>id</i></dt>
 
297
<dd>
 
298
</dd>
 
299
<dt><i>factory</i></dt>
 
300
<dd>
 
301
</dd>
 
302
<dt><i>accept</i></dt>
 
303
<dd>
 
304
</dd>
 
305
</dl><br />
 
306
</dd>
 
307
<dt><a id='PIL.Image.register_save-function' name='PIL.Image.register_save-function'><b>register_save(id, driver)</b></a> [<a href='#PIL.Image.register_save-function'>#</a>]</dt>
 
308
<dd>
 
309
<dl>
 
310
<dt><i>id</i></dt>
 
311
<dd>
 
312
</dd>
 
313
<dt><i>driver</i></dt>
 
314
<dd>
 
315
</dd>
 
316
</dl><br />
 
317
</dd>
 
318
</dl>
 
319
<h2><a id='PIL.Image.Image-class' name='PIL.Image.Image-class'>The Image Class</a></h2>
 
320
<dl>
 
321
<dt><b>Image()</b> (class) [<a href='#PIL.Image.Image-class'>#</a>]</dt>
 
322
<dd>
 
323
</dd>
 
324
<dt><a id='PIL.Image.Image.convert-method' name='PIL.Image.Image.convert-method'><b>convert(mode, matrix=None)</b></a> [<a href='#PIL.Image.Image.convert-method'>#</a>]</dt>
 
325
<dd>
 
326
<p>Returns a converted copy of this image. For the "P" mode, this
 
327
method translates pixels through the palette.  If mode is
 
328
omitted, a mode is chosen so that all information in the image
 
329
and the palette can be represented without a palette.
 
330
</p><p>
 
331
The current version supports all possible conversions between
 
332
"L", "RGB" and "CMYK."
 
333
</p><p>
 
334
When translating a colour image to black and white (mode "L"),
 
335
the library uses the ITU-R 601-2 luma transform:
 
336
</p><p>
 
337
<b>L = R * 299/1000 + G * 587/1000 + B * 114/1000</b>
 
338
</p><p>
 
339
When translating a greyscale image into a bilevel image (mode
 
340
"1"), all non-zero values are set to 255 (white). To use other
 
341
thresholds, use the <a class="link" href="#PIL.Image.Image.point-method"><b>point</b></a> method.
 
342
 
 
343
</p><dl>
 
344
<dt><i>mode</i></dt>
 
345
<dd>
 
346
</dd>
 
347
<dt><i>matrix</i></dt>
 
348
<dd>
 
349
</dd>
 
350
<dt>Returns:</dt>
 
351
<dd>
 
352
</dd>
 
353
</dl><br />
 
354
</dd>
 
355
<dt><a id='PIL.Image.Image.copy-method' name='PIL.Image.Image.copy-method'><b>copy()</b></a> [<a href='#PIL.Image.Image.copy-method'>#</a>]</dt>
 
356
<dd>
 
357
<dl>
 
358
<dt>Returns:</dt>
 
359
<dd>
 
360
</dd>
 
361
</dl><br />
 
362
</dd>
 
363
<dt><a id='PIL.Image.Image.crop-method' name='PIL.Image.Image.crop-method'><b>crop(box=None)</b></a> [<a href='#PIL.Image.Image.crop-method'>#</a>]</dt>
 
364
<dd>
 
365
<p>Returns a rectangular region from this image. The box is a
 
366
4-tuple defining the left, upper, right, and lower pixel
 
367
coordinate.
 
368
</p><p>
 
369
This is a lazy operation.  Changes to the source image may or
 
370
may not be reflected in the cropped image.  To break the
 
371
connection, call the <a class="link" href="#PIL.Image.Image.load-method"><b>load</b></a> method on the cropped
 
372
copy.
 
373
 
 
374
</p><dl>
 
375
<dt><i>The</i></dt>
 
376
<dd>
 
377
</dd>
 
378
<dt>Returns:</dt>
 
379
<dd>
 
380
</dd>
 
381
</dl><br />
 
382
</dd>
 
383
<dt><a id='PIL.Image.Image.draft-method' name='PIL.Image.Image.draft-method'><b>draft(mode, size)</b></a> [<a href='#PIL.Image.Image.draft-method'>#</a>]</dt>
 
384
<dd>
 
385
<p>Configures the image file loader so it returns a version of the
 
386
image that as closely as possible matches the given mode and
 
387
size.  For example, you can use this method to convert a colour
 
388
JPEG to greyscale while loading it, or to extract a 128x192
 
389
version from a PCD file.
 
390
</p><p>
 
391
Note that this method modifies the Image object in place.  If
 
392
the image has already been loaded, this method has no effect.
 
393
 
 
394
</p><dl>
 
395
<dt><i>mode</i></dt>
 
396
<dd>
 
397
</dd>
 
398
<dt><i>size</i></dt>
 
399
<dd>
 
400
</dd>
 
401
</dl><br />
 
402
</dd>
 
403
<dt><a id='PIL.Image.Image.filter-method' name='PIL.Image.Image.filter-method'><b>filter(filter)</b></a> [<a href='#PIL.Image.Image.filter-method'>#</a>]</dt>
 
404
<dd>
 
405
<p>Filters this image using the given filter.  For a list of
 
406
available filters, see the <b>ImageFilter</b> module.
 
407
 
 
408
</p><dl>
 
409
<dt><i>filter</i></dt>
 
410
<dd>
 
411
</dd>
 
412
<dt>Returns:</dt>
 
413
<dd>
 
414
</dd>
 
415
</dl><br />
 
416
</dd>
 
417
<dt><a id='PIL.Image.Image.fromstring-method' name='PIL.Image.Image.fromstring-method'><b>fromstring(data, decoder_name=&quot;raw&quot;, *args)</b></a> [<a href='#PIL.Image.Image.fromstring-method'>#</a>]</dt>
 
418
<dd>
 
419
<p>Loads this image with pixel data from a string.
 
420
</p><p>
 
421
This method is similar to the <a class="link" href="#PIL.Image.fromstring-function"><b>fromstring</b></a> function, but
 
422
loads data into this image instead of creating a new image
 
423
object.
 
424
</p></dd>
 
425
<dt><a id='PIL.Image.Image.getbands-method' name='PIL.Image.Image.getbands-method'><b>getbands()</b></a> [<a href='#PIL.Image.Image.getbands-method'>#</a>]</dt>
 
426
<dd>
 
427
<p>Returns a tuple containing the name of each band in this image.
 
428
For example, <b>getbands</b> on an RGB image returns ("R", "G", "B").
 
429
 
 
430
</p><dl>
 
431
<dt>Returns:</dt>
 
432
<dd>
 
433
</dd>
 
434
</dl><br />
 
435
</dd>
 
436
<dt><a id='PIL.Image.Image.getbbox-method' name='PIL.Image.Image.getbbox-method'><b>getbbox()</b></a> [<a href='#PIL.Image.Image.getbbox-method'>#</a>]</dt>
 
437
<dd>
 
438
<dl>
 
439
<dt>Returns:</dt>
 
440
<dd>
 
441
</dd>
 
442
</dl><br />
 
443
</dd>
 
444
<dt><a id='PIL.Image.Image.getcolors-method' name='PIL.Image.Image.getcolors-method'><b>getcolors(maxcolors=256)</b></a> [<a href='#PIL.Image.Image.getcolors-method'>#</a>]</dt>
 
445
<dd>
 
446
<dl>
 
447
<dt><i>maxcolors</i></dt>
 
448
<dd>
 
449
</dd>
 
450
<dt>Returns:</dt>
 
451
<dd>
 
452
</dd>
 
453
</dl><br />
 
454
</dd>
 
455
<dt><a id='PIL.Image.Image.getdata-method' name='PIL.Image.Image.getdata-method'><b>getdata(band=None)</b></a> [<a href='#PIL.Image.Image.getdata-method'>#</a>]</dt>
 
456
<dd>
 
457
<p>Returns the contents of this image as a sequence object
 
458
containing pixel values.  The sequence object is flattened, so
 
459
that values for line one follow directly after the values of
 
460
line zero, and so on.
 
461
</p><p>
 
462
Note that the sequence object returned by this method is an
 
463
internal PIL data type, which only supports certain sequence
 
464
operations.  To convert it to an ordinary sequence (e.g. for
 
465
printing), use <b>list(im.getdata())</b>.
 
466
 
 
467
</p><dl>
 
468
<dt><i>band</i></dt>
 
469
<dd>
 
470
</dd>
 
471
<dt>Returns:</dt>
 
472
<dd>
 
473
</dd>
 
474
</dl><br />
 
475
</dd>
 
476
<dt><a id='PIL.Image.Image.getextrema-method' name='PIL.Image.Image.getextrema-method'><b>getextrema()</b></a> [<a href='#PIL.Image.Image.getextrema-method'>#</a>]</dt>
 
477
<dd>
 
478
<dl>
 
479
<dt>Returns:</dt>
 
480
<dd>
 
481
</dd>
 
482
</dl><br />
 
483
</dd>
 
484
<dt><a id='PIL.Image.Image.getim-method' name='PIL.Image.Image.getim-method'><b>getim()</b></a> [<a href='#PIL.Image.Image.getim-method'>#</a>]</dt>
 
485
<dd>
 
486
<dl>
 
487
<dt>Returns:</dt>
 
488
<dd>
 
489
</dd>
 
490
</dl><br />
 
491
</dd>
 
492
<dt><a id='PIL.Image.Image.getpalette-method' name='PIL.Image.Image.getpalette-method'><b>getpalette()</b></a> [<a href='#PIL.Image.Image.getpalette-method'>#</a>]</dt>
 
493
<dd>
 
494
<dl>
 
495
<dt>Returns:</dt>
 
496
<dd>
 
497
</dd>
 
498
</dl><br />
 
499
</dd>
 
500
<dt><a id='PIL.Image.Image.getpixel-method' name='PIL.Image.Image.getpixel-method'><b>getpixel(xy)</b></a> [<a href='#PIL.Image.Image.getpixel-method'>#</a>]</dt>
 
501
<dd>
 
502
<dl>
 
503
<dt><i>xy</i></dt>
 
504
<dd>
 
505
</dd>
 
506
<dt>Returns:</dt>
 
507
<dd>
 
508
</dd>
 
509
</dl><br />
 
510
</dd>
 
511
<dt><a id='PIL.Image.Image.getprojection-method' name='PIL.Image.Image.getprojection-method'><b>getprojection()</b></a> [<a href='#PIL.Image.Image.getprojection-method'>#</a>]</dt>
 
512
<dd>
 
513
<dl>
 
514
<dt>Returns:</dt>
 
515
<dd>
 
516
</dd>
 
517
</dl><br />
 
518
</dd>
 
519
<dt><a id='PIL.Image.Image.histogram-method' name='PIL.Image.Image.histogram-method'><b>histogram(mask=None)</b></a> [<a href='#PIL.Image.Image.histogram-method'>#</a>]</dt>
 
520
<dd>
 
521
<p>Returns a histogram for the image. The histogram is returned as
 
522
a list of pixel counts, one for each pixel value in the source
 
523
image. If the image has more than one band, the histograms for
 
524
all bands are concatenated (for example, the histogram for an
 
525
"RGB" image contains 768 values).
 
526
</p><p>
 
527
A bilevel image (mode "1") is treated as a greyscale ("L") image
 
528
by this method.
 
529
</p><p>
 
530
If a mask is provided, the method returns a histogram for those
 
531
parts of the image where the mask image is non-zero. The mask
 
532
image must have the same size as the image, and be either a
 
533
bi-level image (mode "1") or a greyscale image ("L").
 
534
 
 
535
</p><dl>
 
536
<dt><i>mask</i></dt>
 
537
<dd>
 
538
</dd>
 
539
<dt>Returns:</dt>
 
540
<dd>
 
541
</dd>
 
542
</dl><br />
 
543
</dd>
 
544
<dt><a id='PIL.Image.Image.load-method' name='PIL.Image.Image.load-method'><b>load()</b></a> [<a href='#PIL.Image.Image.load-method'>#</a>]</dt>
 
545
<dd>
 
546
<dl>
 
547
<dt>Returns:</dt>
 
548
<dd>
 
549
</dd>
 
550
</dl><br />
 
551
</dd>
 
552
<dt><a id='PIL.Image.Image.offset-method' name='PIL.Image.Image.offset-method'><b>offset(xoffset, yoffset=None)</b></a> [<a href='#PIL.Image.Image.offset-method'>#</a>]</dt>
 
553
<dd>
 
554
<p>(Deprecated) Returns a copy of the image where the data has been
 
555
offset by the given distances. Data wraps around the edges. If
 
556
yoffset is omitted, it is assumed to be equal to xoffset.
 
557
</p><p>
 
558
This method is deprecated. New code should use the <b>offset</b>
 
559
function in the <b>ImageChops</b> module.
 
560
 
 
561
</p><dl>
 
562
<dt><i>xoffset</i></dt>
 
563
<dd>
 
564
</dd>
 
565
<dt><i>yoffset</i></dt>
 
566
<dd>
 
567
</dd>
 
568
<dt>Returns:</dt>
 
569
<dd>
 
570
</dd>
 
571
</dl><br />
 
572
</dd>
 
573
<dt><a id='PIL.Image.Image.paste-method' name='PIL.Image.Image.paste-method'><b>paste(im, box=None, mask=None)</b></a> [<a href='#PIL.Image.Image.paste-method'>#</a>]</dt>
 
574
<dd>
 
575
<p>Pastes another image into this image. The box argument is either
 
576
a 2-tuple giving the upper left corner, a 4-tuple defining the
 
577
left, upper, right, and lower pixel coordinate, or None (same as
 
578
(0, 0)).  If a 4-tuple is given, the size of the pasted image
 
579
must match the size of the region.
 
580
</p><p>
 
581
If the modes don't match, the pasted image is converted to the
 
582
mode of this image (see the <a class="link" href="#PIL.Image.Image.convert-method"><b>convert</b></a> method for
 
583
details).
 
584
</p><p>
 
585
Instead of an image, the source can be a integer or tuple
 
586
containing pixel values.  The method then fills the region
 
587
with the given colour.  When creating RGB images, you can
 
588
also use colour strings as supported by the ImageColor module.
 
589
</p><p>
 
590
If a mask is given, this method updates only the regions
 
591
indicated by the mask.  You can use either "1", "L" or "RGBA"
 
592
images (in the latter case, the alpha band is used as mask).
 
593
Where the mask is 255, the given image is copied as is.  Where
 
594
the mask is 0, the current value is preserved.  Intermediate
 
595
values can be used for transparency effects.
 
596
</p><p>
 
597
Note that if you paste an "RGBA" image, the alpha band is
 
598
ignored.  You can work around this by using the same image as
 
599
both source image and mask.
 
600
 
 
601
</p><dl>
 
602
<dt><i>im</i></dt>
 
603
<dd>
 
604
</dd>
 
605
<dt><i>box</i></dt>
 
606
<dd>
 
607
<p>An optional 4-tuple giving the region to paste into.
 
608
   If a 2-tuple is used instead, it's treated as the upper left
 
609
   corner.  If omitted or None, the source is pasted into the
 
610
   upper left corner.
 
611
   </p><p>
 
612
   If an image is given as the second argument and there is no
 
613
   third, the box defaults to (0, 0), and the second argument
 
614
   is interpreted as a mask image.
 
615
</p></dd>
 
616
<dt><i>mask</i></dt>
 
617
<dd>
 
618
</dd>
 
619
<dt>Returns:</dt>
 
620
<dd>
 
621
</dd>
 
622
</dl><br />
 
623
</dd>
 
624
<dt><a id='PIL.Image.Image.point-method' name='PIL.Image.Image.point-method'><b>point(lut, mode=None)</b></a> [<a href='#PIL.Image.Image.point-method'>#</a>]</dt>
 
625
<dd>
 
626
<dl>
 
627
<dt><i>lut</i></dt>
 
628
<dd>
 
629
</dd>
 
630
<dt><i>mode</i></dt>
 
631
<dd>
 
632
</dd>
 
633
<dt>Returns:</dt>
 
634
<dd>
 
635
</dd>
 
636
</dl><br />
 
637
</dd>
 
638
<dt><a id='PIL.Image.Image.putalpha-method' name='PIL.Image.Image.putalpha-method'><b>putalpha(alpha)</b></a> [<a href='#PIL.Image.Image.putalpha-method'>#</a>]</dt>
 
639
<dd>
 
640
<dl>
 
641
<dt><i>im</i></dt>
 
642
<dd>
 
643
</dd>
 
644
</dl><br />
 
645
</dd>
 
646
<dt><a id='PIL.Image.Image.putdata-method' name='PIL.Image.Image.putdata-method'><b>putdata(data, scale=1.0, offset=0.0)</b></a> [<a href='#PIL.Image.Image.putdata-method'>#</a>]</dt>
 
647
<dd>
 
648
<p>Copies pixel data to this image.  This method copies data from a
 
649
sequence object into the image, starting at the upper left
 
650
corner (0, 0), and continuing until either the image or the
 
651
sequence ends.  The scale and offset values are used to adjust
 
652
the sequence values: <b>pixel = value*scale + offset</b>.
 
653
 
 
654
</p><dl>
 
655
<dt><i>data</i></dt>
 
656
<dd>
 
657
</dd>
 
658
<dt><i>scale</i></dt>
 
659
<dd>
 
660
</dd>
 
661
<dt><i>offset</i></dt>
 
662
<dd>
 
663
</dd>
 
664
</dl><br />
 
665
</dd>
 
666
<dt><a id='PIL.Image.Image.putpalette-method' name='PIL.Image.Image.putpalette-method'><b>putpalette(data)</b></a> [<a href='#PIL.Image.Image.putpalette-method'>#</a>]</dt>
 
667
<dd>
 
668
<dl>
 
669
<dt><i>data</i></dt>
 
670
<dd>
 
671
</dd>
 
672
</dl><br />
 
673
</dd>
 
674
<dt><a id='PIL.Image.Image.putpixel-method' name='PIL.Image.Image.putpixel-method'><b>putpixel(xy, value)</b></a> [<a href='#PIL.Image.Image.putpixel-method'>#</a>]</dt>
 
675
<dd>
 
676
<p>Modifies the pixel at the given position. The colour is given as
 
677
a single numerical value for single-band images, and a tuple for
 
678
multi-band images.
 
679
</p><p>
 
680
Note that this method is relatively slow.  For more extensive
 
681
changes, use <a class="link" href="#PIL.Image.Image.paste-method"><b>paste</b></a> or the <b>ImageDraw</b> module
 
682
instead.
 
683
 
 
684
</p><dl>
 
685
<dt><i>xy</i></dt>
 
686
<dd>
 
687
</dd>
 
688
<dt><i>value</i></dt>
 
689
<dd>
 
690
</dd>
 
691
</dl><br />
 
692
</dd>
 
693
<dt><a id='PIL.Image.Image.resize-method' name='PIL.Image.Image.resize-method'><b>resize(size, filter=NEAREST)</b></a> [<a href='#PIL.Image.Image.resize-method'>#</a>]</dt>
 
694
<dd>
 
695
<dl>
 
696
<dt><i>size</i></dt>
 
697
<dd>
 
698
</dd>
 
699
<dt><i>filter</i></dt>
 
700
<dd>
 
701
An optional resampling filter.  This can be
 
702
   one of <b>NEAREST</b> (use nearest neighbour), <b>BILINEAR</b>
 
703
   (linear interpolation in a 2x2 environment), <b>BICUBIC</b>
 
704
   (cubic spline interpolation in a 4x4 environment), or
 
705
   <b>ANTIALIAS</b> (a high-quality downsampling filter).
 
706
   If omitted, or if the image has mode "1" or "P", it is
 
707
   set <b>NEAREST</b>.
 
708
</dd>
 
709
<dt>Returns:</dt>
 
710
<dd>
 
711
</dd>
 
712
</dl><br />
 
713
</dd>
 
714
<dt><a id='PIL.Image.Image.rotate-method' name='PIL.Image.Image.rotate-method'><b>rotate(angle, filter=NEAREST)</b></a> [<a href='#PIL.Image.Image.rotate-method'>#</a>]</dt>
 
715
<dd>
 
716
<dl>
 
717
<dt><i>angle</i></dt>
 
718
<dd>
 
719
</dd>
 
720
<dt><i>filter</i></dt>
 
721
<dd>
 
722
An optional resampling filter.  This can be
 
723
   one of <b>NEAREST</b> (use nearest neighbour), <b>BILINEAR</b>
 
724
   (linear interpolation in a 2x2 environment), or <b>BICUBIC</b>
 
725
   (cubic spline interpolation in a 4x4 environment).
 
726
   If omitted, or if the image has mode "1" or "P", it is
 
727
   set <b>NEAREST</b>.
 
728
</dd>
 
729
<dt>Returns:</dt>
 
730
<dd>
 
731
</dd>
 
732
</dl><br />
 
733
</dd>
 
734
<dt><a id='PIL.Image.Image.save-method' name='PIL.Image.Image.save-method'><b>save(file, format=None, **options)</b></a> [<a href='#PIL.Image.Image.save-method'>#</a>]</dt>
 
735
<dd>
 
736
<p>Saves this image under the given filename.  If no format is
 
737
specified, the format to use is determined from the filename
 
738
extension, if possible.
 
739
</p><p>
 
740
Keyword options can be used to provide additional instructions
 
741
to the writer. If a writer doesn't recognise an option, it is
 
742
silently ignored. The available options are described later in
 
743
this handbook.
 
744
</p><p>
 
745
You can use a file object instead of a filename. In this case,
 
746
you must always specify the format. The file object must
 
747
implement the <b>seek</b>, <b>tell</b>, and <b>write</b>
 
748
methods, and be opened in binary mode.
 
749
 
 
750
</p><dl>
 
751
<dt><i>file</i></dt>
 
752
<dd>
 
753
</dd>
 
754
<dt><i>format</i></dt>
 
755
<dd>
 
756
</dd>
 
757
<dt><i>**options</i></dt>
 
758
<dd>
 
759
</dd>
 
760
<dt>Returns:</dt>
 
761
<dd>
 
762
</dd>
 
763
<dt>Raises <b>KeyError</b>:</dt><dd>
 
764
</dd>
 
765
<dt>Raises <b>IOError</b>:</dt><dd>
 
766
</dd>
 
767
</dl><br />
 
768
</dd>
 
769
<dt><a id='PIL.Image.Image.seek-method' name='PIL.Image.Image.seek-method'><b>seek(frame)</b></a> [<a href='#PIL.Image.Image.seek-method'>#</a>]</dt>
 
770
<dd>
 
771
<p>Seeks to the given frame in this sequence file. If you seek
 
772
beyond the end of the sequence, the method raises an
 
773
<b>EOFError</b> exception. When a sequence file is opened, the
 
774
library automatically seeks to frame 0.
 
775
</p><p>
 
776
Note that in the current version of the library, most sequence
 
777
formats only allows you to seek to the next frame.
 
778
 
 
779
</p><dl>
 
780
<dt><i>frame</i></dt>
 
781
<dd>
 
782
</dd>
 
783
<dt>Raises <b>EOFError</b>:</dt><dd>
 
784
</dd>
 
785
</dl><br />
 
786
</dd>
 
787
<dt><a id='PIL.Image.Image.show-method' name='PIL.Image.Image.show-method'><b>show(title=None)</b></a> [<a href='#PIL.Image.Image.show-method'>#</a>]</dt>
 
788
<dd>
 
789
<p>Displays this image. This method is mainly intended for
 
790
debugging purposes.
 
791
</p><p>
 
792
On Unix platforms, this method saves the image to a temporary
 
793
PPM file, and calls the <b>xv</b> utility.
 
794
</p><p>
 
795
On Windows, it saves the image to a temporary BMP file, and uses
 
796
the standard BMP display utility to show it (usually Paint).
 
797
 
 
798
</p><dl>
 
799
<dt><i>title</i></dt>
 
800
<dd>
 
801
</dd>
 
802
</dl><br />
 
803
</dd>
 
804
<dt><a id='PIL.Image.Image.split-method' name='PIL.Image.Image.split-method'><b>split()</b></a> [<a href='#PIL.Image.Image.split-method'>#</a>]</dt>
 
805
<dd>
 
806
<dl>
 
807
<dt>Returns:</dt>
 
808
<dd>
 
809
</dd>
 
810
</dl><br />
 
811
</dd>
 
812
<dt><a id='PIL.Image.Image.tell-method' name='PIL.Image.Image.tell-method'><b>tell()</b></a> [<a href='#PIL.Image.Image.tell-method'>#</a>]</dt>
 
813
<dd>
 
814
<dl>
 
815
<dt>Returns:</dt>
 
816
<dd>
 
817
</dd>
 
818
</dl><br />
 
819
</dd>
 
820
<dt><a id='PIL.Image.Image.thumbnail-method' name='PIL.Image.Image.thumbnail-method'><b>thumbnail(size, resample=NEAREST)</b></a> [<a href='#PIL.Image.Image.thumbnail-method'>#</a>]</dt>
 
821
<dd>
 
822
<p>Make this image into a thumbnail.  This method modifies the
 
823
image to contain a thumbnail version of itself, no larger than
 
824
the given size.  This method calculates an appropriate thumbnail
 
825
size to preserve the aspect of the image, calls the <a class="link" href="#PIL.Image.Image.draft-method"><b>draft</b></a> method to configure the file reader (where
 
826
applicable), and finally resizes the image.
 
827
</p><p>
 
828
Note that the bilinear and bicubic filters in the current
 
829
version of PIL are not well-suited for thumbnail generation.
 
830
You should use <b>ANTIALIAS</b> unless speed is much more
 
831
important than quality.
 
832
</p><p>
 
833
Also note that this function modifies the Image object in place.
 
834
If you need to use the full resolution image as well, apply this
 
835
method to a <a class="link" href="#PIL.Image.Image.copy-method"><b>copy</b></a> of the original image.
 
836
 
 
837
</p><dl>
 
838
<dt><i>size</i></dt>
 
839
<dd>
 
840
</dd>
 
841
<dt><i>resample</i></dt>
 
842
<dd>
 
843
Optional resampling filter.  This can be one
 
844
   of <b>NEAREST</b>, <b>BILINEAR</b>, <b>BICUBIC</b>, or
 
845
   <b>ANTIALIAS</b> (best quality).  If omitted, it defaults
 
846
   to <b>NEAREST</b> (this will be changed to ANTIALIAS in a
 
847
   future version).
 
848
</dd>
 
849
<dt>Returns:</dt>
 
850
<dd>
 
851
</dd>
 
852
</dl><br />
 
853
</dd>
 
854
<dt><a id='PIL.Image.Image.tobitmap-method' name='PIL.Image.Image.tobitmap-method'><b>tobitmap(name=&quot;image&quot;)</b></a> [<a href='#PIL.Image.Image.tobitmap-method'>#</a>]</dt>
 
855
<dd>
 
856
<dl>
 
857
<dt><i>name</i></dt>
 
858
<dd>
 
859
</dd>
 
860
<dt>Returns:</dt>
 
861
<dd>
 
862
</dd>
 
863
<dt>Raises <b>ValueError</b>:</dt><dd>
 
864
</dd>
 
865
</dl><br />
 
866
</dd>
 
867
<dt><a id='PIL.Image.Image.tostring-method' name='PIL.Image.Image.tostring-method'><b>tostring(encoder_name=&quot;raw&quot;, *args)</b></a> [<a href='#PIL.Image.Image.tostring-method'>#</a>]</dt>
 
868
<dd>
 
869
<dl>
 
870
<dt><i>encoder_name</i></dt>
 
871
<dd>
 
872
</dd>
 
873
<dt><i>*args</i></dt>
 
874
<dd>
 
875
</dd>
 
876
<dt>Returns:</dt>
 
877
<dd>
 
878
</dd>
 
879
</dl><br />
 
880
</dd>
 
881
<dt><a id='PIL.Image.Image.transform-method' name='PIL.Image.Image.transform-method'><b>transform(size, method, data, resample=NEAREST)</b></a> [<a href='#PIL.Image.Image.transform-method'>#</a>]</dt>
 
882
<dd>
 
883
<p>Transforms this image.  This method creates a new image with the
 
884
given size, and the same mode as the original, and copies data
 
885
to the new image using the given transform.
 
886
</p><p>
 
887
</p><dl>
 
888
<dt><i>size</i></dt>
 
889
<dd>
 
890
</dd>
 
891
<dt><i>method</i></dt>
 
892
<dd>
 
893
The transformation method.  This is one of
 
894
  <b>EXTENT</b> (cut out a rectangular subregion), <b>AFFINE</b>
 
895
  (affine transform), <b>PERSPECTIVE</b> (perspective
 
896
  transform), <b>QUAD</b> (map a quadrilateral to a
 
897
  rectangle), or <b>MESH</b> (map a number of source quadrilaterals
 
898
  in one operation).
 
899
</dd>
 
900
<dt><i>data</i></dt>
 
901
<dd>
 
902
</dd>
 
903
<dt><i>resample</i></dt>
 
904
<dd>
 
905
Optional resampling filter.  It can be one of
 
906
   <b>NEAREST</b> (use nearest neighbour), <b>BILINEAR</b>
 
907
   (linear interpolation in a 2x2 environment), or
 
908
   <b>BICUBIC</b> (cubic spline interpolation in a 4x4
 
909
   environment). If omitted, or if the image has mode
 
910
   "1" or "P", it is set to <b>NEAREST</b>.
 
911
</dd>
 
912
<dt>Returns:</dt>
 
913
<dd>
 
914
</dd>
 
915
</dl><br />
 
916
</dd>
 
917
<dt><a id='PIL.Image.Image.transpose-method' name='PIL.Image.Image.transpose-method'><b>transpose(method)</b></a> [<a href='#PIL.Image.Image.transpose-method'>#</a>]</dt>
 
918
<dd>
 
919
<dl>
 
920
<dt><i>method</i></dt>
 
921
<dd>
 
922
One of <b>FLIP_LEFT_RIGHT</b>, <b>FLIP_TOP_BOTTOM</b>,
 
923
<b>ROTATE_90</b>, <b>ROTATE_180</b>, or <b>ROTATE_270</b>.
 
924
</dd>
 
925
</dl><br />
 
926
</dd>
 
927
<dt><a id='PIL.Image.Image.verify-method' name='PIL.Image.Image.verify-method'><b>verify()</b></a> [<a href='#PIL.Image.Image.verify-method'>#</a>]</dt>
 
928
<dd>
 
929
</dd>
 
930
</dl>
 
931
</body></html>