Skip to content

Conversation

@LangQi99
Copy link
Contributor

@LangQi99 LangQi99 commented Sep 7, 2025

PR summary

Closes #26092

Per community consensus in #26092, the behavior for RGBA inputs has been changed from overwriting to blending; the image's intrinsic alpha is now multiplied with the passed alpha value. This change unifies alpha handling for 2D, RGB, and RGBA images, making the behavior consistent and predictable.

PR checklist

@LangQi99 LangQi99 changed the title Draft: Fix: support alpha array for RGB images (closes #26092) Draft: Fix: support alpha array for RGBA images (closes #26092) Sep 7, 2025
@github-actions github-actions bot added the Documentation: examples files in galleries/examples label Sep 7, 2025
@LangQi99 LangQi99 changed the title Draft: Fix: support alpha array for RGBA images (closes #26092) Fix: support alpha array for RGBA images (closes #26092) Sep 7, 2025
@LangQi99 LangQi99 marked this pull request as ready for review September 7, 2025 17:04
@LangQi99
Copy link
Contributor Author

LangQi99 commented Sep 8, 2025

Old Behavior pay attention to the bottom right
Figure_2

New Behavior
Figure_fix

@LangQi99 LangQi99 changed the title Fix: support alpha array for RGBA images (closes #26092) Fix: Change alpha application for RGBA from overwrite to multiply Sep 9, 2025
Copy link
Member

@rcomer rcomer left a comment

Choose a reason for hiding this comment

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

Thank you for your work on this @LangQi99 and sorry you did not get a response sooner. The fix looks right to me. However, this is a breaking change, as shown by the modified test. I do not think we can reasonably provide a deprecation pathway for this, but it should have an API change note.

(im_rgb,
(scalar_alpha * array_alpha).reshape((ny, nx, 1))),
axis=-1),
interpolation_stage=intp_stage)
Copy link
Member

Choose a reason for hiding this comment

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

This looks like a style-only change. Please revert.

@rcomer
Copy link
Member

rcomer commented Dec 17, 2025

Hi @LangQi99 are you still working on this one? If not, we can close in favour of #30795, which is closer to completion, but I do not want to do that if you are actively working on this.

@LangQi99
Copy link
Contributor Author

I'm not working on this currently. Feel free to close it.

@rcomer
Copy link
Member

rcomer commented Dec 17, 2025

Thanks for the quick reply @LangQi99. Closing in favour of #30795.

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()

2 participants