photo uploader and manipulator
To upload files, please first save the app
import streamlit as st
from PIL import Image
import numpy as np
st.title("Photo Uploader and Manipulator")
uploaded_file = st.file_uploader("Choose an image", type=["jpg", "jpeg", "png"])
if uploaded_file is not None:
image = Image.open(uploaded_file)
st.image(image, caption="Uploaded Image", use_column_width=True)
st.write("\nManipulate Image:\")
if st.button("Convert to Grayscale"):
gray_image = image.convert("L")
st.image(gray_image, caption="Grayscale Image", use_column_width=True)
if st.button("Resize Image"):
width = st.number_input("Width", value=image.width)
height = st.number_input("Height", value=image.height)
resized_image = image.resize((width, height))
st.image(resized_image, caption="Resized Image", use_column_width=True)
if st.button("Rotate Image"):
angle = st.number_input("Angle", value=0)
rotated_image = image.rotate(angle)
st.image(rotated_image, caption="Rotated Image", use_column_width=True)
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?