Description:
Hi there,
I've noticed that when using streamlit-image-comparison to compare images that have transparency (like PNG files with an alpha channel), the transparency information seems to be lost in the displayed comparison.
Problem:
Transparent areas in the source images are rendered as opaque (often solid black) within the comparison component. This makes it difficult to accurately compare images where transparency is important.
Steps to Reproduce:
- Create a simple Streamlit app.
- Load one image that has transparency, and another that doesn't. This makes the issue very clear. (You can use the example image attached to this issue).
- Use the
image_comparison function to display them.
Expected Behavior:
The streamlit-image-comparison component should display the images while preserving their transparency. Transparent areas should remain transparent, showing the underlying background color.
Actual Behavior:
The transparent areas are rendered as opaque (often black), as seen in the comparison view. The standard st.image function correctly displays the transparency for the same uploaded image.

The image I attached when creating this issue demonstrates the problem. The transparent background is lost in the comparison.
Environment:
streamlit-image-comparison version: 0.0.4
streamlit version: 1.44.1
- Python version: 3.12.0
- OS: Windows 10
- Browser: Brave (Chromium)
Description:
Hi there,
I've noticed that when using
streamlit-image-comparisonto compare images that have transparency (like PNG files with an alpha channel), the transparency information seems to be lost in the displayed comparison.Problem:
Transparent areas in the source images are rendered as opaque (often solid black) within the comparison component. This makes it difficult to accurately compare images where transparency is important.
Steps to Reproduce:
image_comparisonfunction to display them.Expected Behavior:
The
streamlit-image-comparisoncomponent should display the images while preserving their transparency. Transparent areas should remain transparent, showing the underlying background color.Actual Behavior:
The transparent areas are rendered as opaque (often black), as seen in the comparison view. The standard st.image function correctly displays the transparency for the same uploaded image.
The image I attached when creating this issue demonstrates the problem. The transparent background is lost in the comparison.
Environment:
streamlit-image-comparisonversion: 0.0.4streamlitversion: 1.44.1