@@ -1419,11 +1419,20 @@ def imsave(fname, arr, vmin=None, vmax=None, cmap=None, format=None,
1419
1419
1420
1420
1421
1421
def pil_to_array (pilImage ):
1422
- """Load a PIL image and return it as a numpy array.
1422
+ """Load a `PIL image`_ and return it as a numpy array.
1423
+
1424
+ .. _PIL image: https://pillow.readthedocs.io/en/latest/reference/Image.html
1425
+
1426
+ Returns
1427
+ -------
1428
+ numpy.array
1429
+
1430
+ The array shape depends on the image type:
1431
+
1432
+ - (M, N) for grayscale images.
1433
+ - (M, N, 3) for RGB images.
1434
+ - (M, N, 4) for RGBA images.
1423
1435
1424
- Grayscale images are returned as ``(M, N)`` arrays. RGB images are
1425
- returned as ``(M, N, 3)`` arrays. RGBA images are returned as ``(M, N,
1426
- 4)`` arrays.
1427
1436
"""
1428
1437
if pilImage .mode in ['RGBA' , 'RGBX' , 'RGB' , 'L' ]:
1429
1438
# return MxNx4 RGBA, MxNx3 RBA, or MxN luminance array
@@ -1453,20 +1462,21 @@ def thumbnail(infile, thumbfile, scale=0.1, interpolation='bilinear',
1453
1462
1454
1463
Parameters
1455
1464
----------
1456
- infile
1465
+ infile : str or file-like
1457
1466
The image file -- must be PNG, Pillow-readable if you have `Pillow
1458
1467
<http://python-pillow.org/>`_ installed.
1459
1468
1460
- thumbfile
1469
+ thumbfile : str or file-like
1461
1470
The thumbnail filename.
1462
1471
1463
- scale
1472
+ scale : float, optional
1464
1473
The scale factor for the thumbnail.
1465
1474
1466
- interpolation
1467
- The interpolation scheme used in the resampling.
1475
+ interpolation : str, optional
1476
+ The interpolation scheme used in the resampling. See the
1477
+ *interpolation* parameter of `~.Axes.imshow` for possible values.
1468
1478
1469
- preview
1479
+ preview : bool, optional
1470
1480
If True, the default backend (presumably a user interface
1471
1481
backend) will be used which will cause a figure to be raised if
1472
1482
`~matplotlib.pyplot.show` is called. If it is False, the figure is
@@ -1475,7 +1485,7 @@ def thumbnail(infile, thumbfile, scale=0.1, interpolation='bilinear',
1475
1485
1476
1486
Returns
1477
1487
-------
1478
- figure :
1488
+ figure : `~.figure.Figure`
1479
1489
The figure instance containing the thumbnail.
1480
1490
"""
1481
1491
0 commit comments