Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for alpha channel in st.image's channels argument #8586

Open
2 tasks done
SebastianScherer88 opened this issue Apr 29, 2024 · 1 comment
Open
2 tasks done
Labels
feature:st.image type:enhancement Requests for feature enhancements or new features

Comments

@SebastianScherer88
Copy link

Checklist

  • I have searched the existing issues for similar feature requests.
  • I added a descriptive title and summary to this issue.

Summary

The current implementation of the st.image image display utility only supports two options in its channels argument: RGB and RBG. It would be great if the displaying of images with an additional fourth alpha channel (controlling the opacity) would be supported, maybe via additional supported channel modes RGBA and RBGA.

Why?

Rendering images with alpha channel masks have the masks ignored, and so default to the image color channel values in the areas where the mask indicates transparency.

How?

See summary section - hopefully that is feasible/makes sense.

As an alternative, I will try dynamically rendering images with masks to take on the colour of currently selected background colours, although that is finicky.

Additional Context

example where the transparent section of the image is still shown despite the mask being 0 in those pixels:
image

@SebastianScherer88 SebastianScherer88 added the type:enhancement Requests for feature enhancements or new features label Apr 29, 2024
Copy link

To help Streamlit prioritize this feature, react with a 👍 (thumbs up emoji) to the initial post.

Your vote helps us identify which enhancements matter most to our users.

Visits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature:st.image type:enhancement Requests for feature enhancements or new features
Projects
None yet
Development

No branches or pull requests

2 participants