Hello Streamlit community,
I hope this message finds you well. I’m currently working on a Streamlit project, generating images using the PIL (Python Imaging Library) library. My goal is to display these images with the highest possible quality from the original source (2400x1600) while controlling their size on the page.
def combine_images(background, overlay, position=(0, 0), inverse_color=False, isPath=True, size = (256,256)):
# Resize overlay image if needed
overlay = overlay.resize(size)
# Invert colors if specified
if inverse_color:
overlay = ImageOps.invert(overlay.convert("RGB"))
# Paste the overlay image onto the background
background.paste(overlay, position, overlay)
return background
def display_png(img):
st.image(img, use_column_width=True, output_format='PNG')
If anyone has experience or insights into optimizing image quality and size control in a Streamlit app with images generated using PIL, I would greatly appreciate your assistance. Feel free to check out my current project on website for context.
Thank you in advance for your help!
Best regards