Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/matplotlib/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -1586,9 +1586,11 @@ def imsave(fname, arr, vmin=None, vmax=None, cmap=None, format=None,
# because that's what backend_agg passes, and can be in fact used
# as is, saving a few operations.
rgba = arr
elif arr.ndim == 3 and arr.shape[-1] in (3,4):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work for shape[-1] == 3? AFAICS, rgba should have the alpha component included eventually?

rgba = arr
else:
sm = mcolorizer.Colorizer(cmap=cmap)
sm.set_clim(vmin, vmax)
sm.set_clim(vim, vmax)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like an unintended edit

rgba = sm.to_rgba(arr, bytes=True)
if pil_kwargs is None:
pil_kwargs = {}
Expand Down