From c2fb20a149184a187084439bd8e3866a8591c4f8 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Mon, 31 Oct 2022 23:48:37 +0100 Subject: [PATCH] Backport PR #24320: DOC: add warning note to imsave --- lib/matplotlib/image.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/image.py b/lib/matplotlib/image.py index 6401b64dc248..1fe8c048ea5e 100644 --- a/lib/matplotlib/image.py +++ b/lib/matplotlib/image.py @@ -1547,7 +1547,15 @@ def imread(fname, format=None): def imsave(fname, arr, vmin=None, vmax=None, cmap=None, format=None, origin=None, dpi=100, *, metadata=None, pil_kwargs=None): """ - Save an array as an image file. + Colormap and save an array as an image file. + + RGB(A) images are passed through. Single channel images will be + colormapped according to *cmap* and *norm*. + + .. note :: + + If you want to save a single channel image as gray scale please use an + image I/O library (such as pillow, tifffile, or imageio) directly. Parameters ----------