Fix alpha array ignored for RGB images in imshow. by matthewlos · Pull Request #31171 · matplotlib/matplotlib · GitHub
Skip to content

Fix alpha array ignored for RGB images in imshow. - #31171

Closed
matthewlos wants to merge 1 commit into
matplotlib:mainfrom
matthewlos:fix-alpha-array-rgb-imageshow
Closed

matthewlos wants to merge 1 commit into
matplotlib:mainfrom
matthewlos:fix-alpha-array-rgb-imageshow

Conversation

@matthewlos

@matthewlos matthewlos commented Feb 18, 2026

Copy link
Copy Markdown

Array alpha was silently ignored when passing RGB image data to imshow(). For RGBA images, array alpha replaced the existing alpha channel instead of multiplying with it.

Now array alpha is used directly for RGB (3-channel) input, and multiplied with the existing alpha channel for RGBA (4-channel) input, consistent with scalar alpha behavior.

Closes #26092

PR summary

PR checklist

Array alpha was silently ignored when passing RGB image data to
imshow(). For RGBA images, array alpha replaced the existing alpha
channel instead of multiplying with it.

Now array alpha is used directly for RGB (3-channel) input, and
multiplied with the existing alpha channel for RGBA (4-channel)
input, consistent with scalar alpha behavior.

Closes matplotlib#26092
@github-actions

Copy link
Copy Markdown

@ayshih

ayshih commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

This PR has identical code changes as #30795.

Array alpha was silently ignored when passing RGB image data to imshow().

As a correction to what is written, this first bug was already fixed a long time ago, so is not something fixed by this PR.

@rcomer

rcomer commented Feb 28, 2026

Copy link
Copy Markdown
Member

@rcomer rcomer closed this Feb 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: alpha array-type not working with RGB image in imshow()

3 participants