Skip to content

Commit 92561bd

Browse files
authored
Merge pull request #4697 from nulano/docs-imageshow
2 parents 685c043 + 224ef2f commit 92561bd

29 files changed

Lines changed: 393 additions & 221 deletions

docs/PIL.rst

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ PIL Package (autodoc of remaining modules)
44
Reference for modules whose documentation has not yet been ported or written
55
can be found here.
66

7+
:mod:`PIL` Module
8+
-----------------
9+
10+
.. py:module:: PIL
11+
12+
.. autoexception:: UnidentifiedImageError
13+
:show-inheritance:
14+
715
:mod:`BdfFontFile` Module
816
-------------------------
917

@@ -52,21 +60,12 @@ can be found here.
5260
:undoc-members:
5361
:show-inheritance:
5462

55-
.. intentionally skipped documenting this because it's not documented anywhere
56-
5763
:mod:`ImageDraw2` Module
5864
------------------------
5965

6066
.. automodule:: PIL.ImageDraw2
6167
:members:
62-
:undoc-members:
63-
:show-inheritance:
64-
65-
:mod:`ImageShow` Module
66-
-----------------------
67-
68-
.. automodule:: PIL.ImageShow
69-
:members:
68+
:member-order: bysource
7069
:undoc-members:
7170
:show-inheritance:
7271

@@ -78,14 +77,6 @@ can be found here.
7877
:undoc-members:
7978
:show-inheritance:
8079

81-
:mod:`JpegPresets` Module
82-
-------------------------
83-
84-
.. automodule:: PIL.JpegPresets
85-
:members:
86-
:undoc-members:
87-
:show-inheritance:
88-
8980
:mod:`PaletteFile` Module
9081
-------------------------
9182

@@ -140,12 +131,3 @@ can be found here.
140131
:members:
141132
:undoc-members:
142133
:show-inheritance:
143-
144-
:mod:`_binary` Module
145-
---------------------
146-
147-
.. automodule:: PIL._binary
148-
:members:
149-
:undoc-members:
150-
:show-inheritance:
151-

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# -- General configuration ------------------------------------------------
2323

2424
# If your documentation needs a minimal Sphinx version, state it here.
25-
# needs_sphinx = '1.0'
25+
needs_sphinx = "2.4"
2626

2727
# Add any Sphinx extension module names here, as strings. They can be
2828
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom

docs/reference/ExifTags.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
The :py:mod:`ExifTags` module exposes two dictionaries which
88
provide constants and clear-text names for various well-known EXIF tags.
99

10-
.. py:class:: PIL.ExifTags.TAGS
10+
.. py:data:: TAGS
11+
:type: dict
1112

1213
The TAG dictionary maps 16-bit integer EXIF tag enumerations to
1314
descriptive string names. For instance:
@@ -16,7 +17,8 @@ provide constants and clear-text names for various well-known EXIF tags.
1617
>>> TAGS[0x010e]
1718
'ImageDescription'
1819

19-
.. py:class:: PIL.ExifTags.GPSTAGS
20+
.. py:data:: GPSTAGS
21+
:type: dict
2022

2123
The GPSTAGS dictionary maps 8-bit integer EXIF gps enumerations to
2224
descriptive string names. For instance:

docs/reference/ImageDraw.rst

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ Example: Draw Multiline Text
124124
Functions
125125
---------
126126

127-
.. py:class:: PIL.ImageDraw.Draw(im, mode=None)
127+
.. py:method:: Draw(im, mode=None)
128128
129129
Creates an object that can be used to draw in the given image.
130130

@@ -140,13 +140,13 @@ Functions
140140
Methods
141141
-------
142142

143-
.. py:method:: PIL.ImageDraw.ImageDraw.getfont()
143+
.. py:method:: ImageDraw.getfont()
144144
145145
Get the current default font.
146146

147147
:returns: An image font.
148148

149-
.. py:method:: PIL.ImageDraw.ImageDraw.arc(xy, start, end, fill=None, width=0)
149+
.. py:method:: ImageDraw.arc(xy, start, end, fill=None, width=0)
150150
151151
Draws an arc (a portion of a circle outline) between the start and end
152152
angles, inside the given bounding box.
@@ -162,7 +162,7 @@ Methods
162162

163163
.. versionadded:: 5.3.0
164164

165-
.. py:method:: PIL.ImageDraw.ImageDraw.bitmap(xy, bitmap, fill=None)
165+
.. py:method:: ImageDraw.bitmap(xy, bitmap, fill=None)
166166
167167
Draws a bitmap (mask) at the given position, using the current fill color
168168
for the non-zero portions. The bitmap should be a valid transparency mask
@@ -173,7 +173,7 @@ Methods
173173
To paste pixel data into an image, use the
174174
:py:meth:`~PIL.Image.Image.paste` method on the image itself.
175175

176-
.. py:method:: PIL.ImageDraw.ImageDraw.chord(xy, start, end, fill=None, outline=None, width=1)
176+
.. py:method:: ImageDraw.chord(xy, start, end, fill=None, outline=None, width=1)
177177
178178
Same as :py:meth:`~PIL.ImageDraw.ImageDraw.arc`, but connects the end points
179179
with a straight line.
@@ -187,7 +187,7 @@ Methods
187187

188188
.. versionadded:: 5.3.0
189189

190-
.. py:method:: PIL.ImageDraw.ImageDraw.ellipse(xy, fill=None, outline=None, width=1)
190+
.. py:method:: ImageDraw.ellipse(xy, fill=None, outline=None, width=1)
191191
192192
Draws an ellipse inside the given bounding box.
193193

@@ -200,9 +200,9 @@ Methods
200200

201201
.. versionadded:: 5.3.0
202202

203-
.. py:method:: PIL.ImageDraw.ImageDraw.line(xy, fill=None, width=0, joint=None)
203+
.. py:method:: ImageDraw.line(xy, fill=None, width=0, joint=None)
204204
205-
Draws a line between the coordinates in the **xy** list.
205+
Draws a line between the coordinates in the ``xy`` list.
206206

207207
:param xy: Sequence of either 2-tuples like ``[(x, y), (x, y), ...]`` or
208208
numeric values like ``[x, y, x, y, ...]``.
@@ -216,7 +216,7 @@ Methods
216216

217217
.. versionadded:: 5.3.0
218218

219-
.. py:method:: PIL.ImageDraw.ImageDraw.pieslice(xy, start, end, fill=None, outline=None, width=1)
219+
.. py:method:: ImageDraw.pieslice(xy, start, end, fill=None, outline=None, width=1)
220220
221221
Same as arc, but also draws straight lines between the end points and the
222222
center of the bounding box.
@@ -233,15 +233,15 @@ Methods
233233

234234
.. versionadded:: 5.3.0
235235

236-
.. py:method:: PIL.ImageDraw.ImageDraw.point(xy, fill=None)
236+
.. py:method:: ImageDraw.point(xy, fill=None)
237237
238238
Draws points (individual pixels) at the given coordinates.
239239

240240
:param xy: Sequence of either 2-tuples like ``[(x, y), (x, y), ...]`` or
241241
numeric values like ``[x, y, x, y, ...]``.
242242
:param fill: Color to use for the point.
243243

244-
.. py:method:: PIL.ImageDraw.ImageDraw.polygon(xy, fill=None, outline=None)
244+
.. py:method:: ImageDraw.polygon(xy, fill=None, outline=None)
245245
246246
Draws a polygon.
247247

@@ -254,7 +254,7 @@ Methods
254254
:param outline: Color to use for the outline.
255255
:param fill: Color to use for the fill.
256256

257-
.. py:method:: PIL.ImageDraw.ImageDraw.rectangle(xy, fill=None, outline=None, width=1)
257+
.. py:method:: ImageDraw.rectangle(xy, fill=None, outline=None, width=1)
258258
259259
Draws a rectangle.
260260

@@ -267,13 +267,13 @@ Methods
267267

268268
.. versionadded:: 5.3.0
269269

270-
.. py:method:: PIL.ImageDraw.ImageDraw.shape(shape, fill=None, outline=None)
270+
.. py:method:: ImageDraw.shape(shape, fill=None, outline=None)
271271
272272
.. warning:: This method is experimental.
273273

274274
Draw a shape.
275275

276-
.. py:method:: PIL.ImageDraw.ImageDraw.text(xy, text, fill=None, font=None, anchor=None, spacing=4, align="left", direction=None, features=None, language=None, stroke_width=0, stroke_fill=None)
276+
.. py:method:: ImageDraw.text(xy, text, fill=None, font=None, anchor=None, spacing=4, align="left", direction=None, features=None, language=None, stroke_width=0, stroke_fill=None)
277277
278278
Draws the string at the given position.
279279

@@ -325,7 +325,7 @@ Methods
325325

326326
.. versionadded:: 6.2.0
327327

328-
.. py:method:: PIL.ImageDraw.ImageDraw.multiline_text(xy, text, fill=None, font=None, anchor=None, spacing=4, align="left", direction=None, features=None, language=None)
328+
.. py:method:: ImageDraw.multiline_text(xy, text, fill=None, font=None, anchor=None, spacing=4, align="left", direction=None, features=None, language=None)
329329
330330
Draws the string at the given position.
331331

@@ -362,7 +362,7 @@ Methods
362362

363363
.. versionadded:: 6.0.0
364364

365-
.. py:method:: PIL.ImageDraw.ImageDraw.textsize(text, font=None, spacing=4, direction=None, features=None, language=None, stroke_width=0)
365+
.. py:method:: ImageDraw.textsize(text, font=None, spacing=4, direction=None, features=None, language=None, stroke_width=0)
366366
367367
Return the size of the given string, in pixels.
368368

@@ -401,7 +401,7 @@ Methods
401401

402402
.. versionadded:: 6.2.0
403403

404-
.. py:method:: PIL.ImageDraw.ImageDraw.multiline_textsize(text, font=None, spacing=4, direction=None, features=None, language=None, stroke_width=0)
404+
.. py:method:: ImageDraw.multiline_textsize(text, font=None, spacing=4, direction=None, features=None, language=None, stroke_width=0)
405405
406406
Return the size of the given string, in pixels.
407407

@@ -439,7 +439,7 @@ Methods
439439

440440
.. versionadded:: 6.2.0
441441

442-
.. py:method:: PIL.ImageDraw.getdraw(im=None, hints=None)
442+
.. py:method:: getdraw(im=None, hints=None)
443443
444444
.. warning:: This method is experimental.
445445

@@ -450,7 +450,7 @@ Methods
450450
:param hints: An optional list of hints.
451451
:returns: A (drawing context, drawing resource factory) tuple.
452452

453-
.. py:method:: PIL.ImageDraw.floodfill(image, xy, value, border=None, thresh=0)
453+
.. py:method:: floodfill(image, xy, value, border=None, thresh=0)
454454
455455
.. warning:: This method is experimental.
456456

docs/reference/ImageEnhance.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ Classes
2929
All enhancement classes implement a common interface, containing a single
3030
method:
3131

32-
.. py:class:: PIL.ImageEnhance._Enhance
32+
.. py:class:: _Enhance
33+
3334
.. py:method:: enhance(factor)
3435
3536
Returns an enhanced image.
@@ -40,7 +41,7 @@ method:
4041
etc), and higher values more. There are no restrictions
4142
on this value.
4243

43-
.. py:class:: PIL.ImageEnhance.Color(image)
44+
.. py:class:: Color(image)
4445
4546
Adjust image color balance.
4647

@@ -49,23 +50,23 @@ method:
4950
factor of 0.0 gives a black and white image. A factor of 1.0 gives
5051
the original image.
5152

52-
.. py:class:: PIL.ImageEnhance.Contrast(image)
53+
.. py:class:: Contrast(image)
5354
5455
Adjust image contrast.
5556

5657
This class can be used to control the contrast of an image, similar
5758
to the contrast control on a TV set. An enhancement factor of 0.0
5859
gives a solid grey image. A factor of 1.0 gives the original image.
5960

60-
.. py:class:: PIL.ImageEnhance.Brightness(image)
61+
.. py:class:: Brightness(image)
6162
6263
Adjust image brightness.
6364

6465
This class can be used to control the brightness of an image. An
6566
enhancement factor of 0.0 gives a black image. A factor of 1.0 gives the
6667
original image.
6768

68-
.. py:class:: PIL.ImageEnhance.Sharpness(image)
69+
.. py:class:: Sharpness(image)
6970
7071
Adjust image sharpness.
7172

docs/reference/ImageShow.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.. py:module:: PIL.ImageShow
2+
.. py:currentmodule:: PIL.ImageShow
3+
4+
:py:mod:`ImageShow` Module
5+
==========================
6+
7+
The :py:mod:`ImageShow` Module is used to display images.
8+
All default viewers convert the image to be shown to PNG format.
9+
10+
.. autofunction:: PIL.ImageShow.show
11+
12+
.. autoclass:: WindowsViewer
13+
.. autoclass:: MacViewer
14+
15+
.. class:: UnixViewer
16+
17+
The following viewers may be registered on Unix-based systems, if the given command is found:
18+
19+
.. autoclass:: PIL.ImageShow.DisplayViewer
20+
.. autoclass:: PIL.ImageShow.EogViewer
21+
.. autoclass:: PIL.ImageShow.XVViewer
22+
23+
.. autofunction:: PIL.ImageShow.register
24+
.. autoclass:: PIL.ImageShow.Viewer
25+
:member-order: bysource
26+
:members:
27+
:undoc-members:

docs/reference/ImageStat.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
The :py:mod:`ImageStat` module calculates global statistics for an image, or
88
for a region of an image.
99

10-
.. py:class:: PIL.ImageStat.Stat(image_or_list, mask=None)
10+
.. py:class:: Stat(image_or_list, mask=None)
1111
1212
Calculate statistics for the given image. If a mask is included,
1313
only the regions covered by that mask are included in the
@@ -22,13 +22,13 @@ for a region of an image.
2222

2323
.. note::
2424

25-
This relies on the :py:meth:`~PIL.Image.histogram` method, and
25+
This relies on the :py:meth:`~PIL.Image.Image.histogram` method, and
2626
simply returns the low and high bins used. This is correct for
2727
images with 8 bits per channel, but fails for other modes such as
28-
``I`` or ``F``. Instead, use :py:meth:`~PIL.Image.getextrema` to
28+
``I`` or ``F``. Instead, use :py:meth:`~PIL.Image.Image.getextrema` to
2929
return per-band extrema for the image. This is more correct and
3030
efficient because, for non-8-bit modes, the histogram method uses
31-
:py:meth:`~PIL.Image.getextrema` to determine the bins used.
31+
:py:meth:`~PIL.Image.Image.getextrema` to determine the bins used.
3232

3333
.. py:attribute:: count
3434

docs/reference/JpegPresets.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.. py:currentmodule:: PIL.JpegPresets
2+
3+
:py:mod:`JpegPresets` Module
4+
============================
5+
6+
.. automodule:: PIL.JpegPresets
7+
8+
.. data:: presets
9+
:type: dict
10+
11+
A dictionary of all supported presets.

0 commit comments

Comments
 (0)