@@ -1398,16 +1398,15 @@ def imread(fname, format=None):
1398
1398
def imsave (fname , arr , vmin = None , vmax = None , cmap = None , format = None ,
1399
1399
origin = None , dpi = 100 ):
1400
1400
"""
1401
- Save an array as in image file.
1402
-
1403
- The output formats available depend on the backend being used.
1401
+ Save an array as an image file.
1404
1402
1405
1403
Parameters
1406
1404
----------
1407
- fname : str or file-like
1408
- The filename or a Python file-like object to store the image in.
1409
- The necessary output format is inferred from the filename extension
1410
- but may be explicitly overwritten using *format*.
1405
+ fname : str or PathLike file-like
1406
+ A path or a Python file-like object to store the image in.
1407
+ If *format* is not set, then the output format is inferred from the
1408
+ extension of *fname*, if any, and from :rc:`savefig.format` otherwise.
1409
+ If *format* is set, it determines the output format.
1411
1410
arr : array-like
1412
1411
The image data. The shape can be one of
1413
1412
MxN (luminance), MxNx3 (RGB) or MxNx4 (RGBA).
@@ -1421,9 +1420,8 @@ def imsave(fname, arr, vmin=None, vmax=None, cmap=None, format=None,
1421
1420
maps scalar data to colors. It is ignored for RGB(A) data.
1422
1421
Defaults to :rc:`image.cmap` ('viridis').
1423
1422
format : str, optional
1424
- The file format, e.g. 'png', 'pdf', 'svg', ... . If not given, the
1425
- format is deduced form the filename extension in *fname*.
1426
- See `.Figure.savefig` for details.
1423
+ The file format, e.g. 'png', 'pdf', 'svg', ... The behavior when this
1424
+ is unset is documented under *fname*.
1427
1425
origin : {'upper', 'lower'}, optional
1428
1426
Indicates whether the ``(0, 0)`` index of the array is in the upper
1429
1427
left or lower left corner of the axes. Defaults to :rc:`image.origin`
0 commit comments