We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
import streamlit as st from PIL import Image from PIL.ImageFilter import * from PIL import ImageEnhance st.markdown("<h1 style='text-align: center;'>Image Editor</h1>",unsafe_allow_html=True) st.markdown("---") image=st.file_uploader("upload Image",type=["jpg","png","jpeg"]) info=st.empty() size=st.empty() mode=st.empty() format_=st.empty() if image: img = Image.open(image) info.markdown("<h2 style='text-align:left;'>Information</h2>",unsafe_allow_html=True) size.markdown(f"<h6>size: {img.size} </h6>",unsafe_allow_html=True) mode.markdown(f"<h6>mode: {img.mode} </h6>",unsafe_allow_html=True) format_.markdown(f"<h6>format: {img.format} </h6>",unsafe_allow_html=True) st.markdown("<h2 style='text-align:left;'>Resizing</h2>",unsafe_allow_html=True) width=st.number_input("width",value=img.width) height=st.number_input("height",value=img.height) st.markdown("<h2 style='text-align:left;'>Rotation</h2>",unsafe_allow_html=True) degree=st.number_input("degree",) st.markdown("<h2 style='text-align:left;'>Filters</h2>",unsafe_allow_html=True) filters = st.selectbox("Filters", options=("None","Blur","Detail","Emboss","Smooth","Sharpen","Contour","Edge Enhance","Gussian Blur","Brightness","Contrast","Colour Enhancement")) s_btn=st.button("submit") if s_btn: edited=img.resize((width,height)).rotate(degree) filtered=edited if filters != "None": if filters == "Blur": blur_radius = st.slider("Blur Radius",0,10) filtered=edited.filter(BLUR) elif filters == "Detail": detail_radius = st.slider("Detail Radius",0,10) filtered=edited.filter(DETAIL) elif filters == "Emboss": emboss_radius= st.slider("Embose Radius",0,10) filtered=edited.filter(EMBOSS) elif filter == "Smooth": smooth_amount=st.slider("Smooth Amount",0,10) filtered=edited.filter(SMOOTH) elif filter == "Sharpen": sharpen_radius =st.slider("Sharpen Radius",0,10) filtered=edited.filter(SHARPEN) elif filter == "Brightness": brightness_factor =st.slider("Brightness Factor",0.0,3.0,1.0) enhancer = ImageEnhance.Brightness(edited) filtered=enhancer.enhance(brightness_factor) elif filter == "Contrast": contrast_factor = st.slider("Contrast Factor", 0.0, 3.0, 1.0) enhancer = ImageEnhance.Contrast(edited) filtered = enhancer.enhance(contrast_factor) elif filter == "Color Enhancement": red_factor = st.slider("Red Factor", 0.0, 3.0, 1.0) green_factor = st.slider("Green Factor", 0.0, 3.0, 1.0) blue_factor = st.slider("Blue Factor", 0.0, 3.0, 1.0) st.image(filtered, caption='Processed Image', use_column_width=True)
import streamlit as st from PIL import Image from PIL.ImageFilter import * from PIL import ImageEnhance
st.markdown("
st.image(filtered, caption='Processed Image', use_column_width=True)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Prerequisites
Exception report
Screenshot
import streamlit as st
from PIL import Image
from PIL.ImageFilter import *
from PIL import ImageEnhance
st.markdown("
Image Editor
",unsafe_allow_html=True)st.markdown("---")
image=st.file_uploader("upload Image",type=["jpg","png","jpeg"])
info=st.empty()
size=st.empty()
mode=st.empty()
format_=st.empty()
if image:
img = Image.open(image)
info.markdown("
Information
",unsafe_allow_html=True)size.markdown(f"
size: {img.size}
",unsafe_allow_html=True)mode.markdown(f"
mode: {img.mode}
",unsafe_allow_html=True)format_.markdown(f"
format: {img.format}
",unsafe_allow_html=True)st.markdown("
Resizing
",unsafe_allow_html=True)width=st.number_input("width",value=img.width)
height=st.number_input("height",value=img.height)
st.markdown("
Rotation
",unsafe_allow_html=True)degree=st.number_input("degree",)
st.markdown("
Filters
",unsafe_allow_html=True)filters = st.selectbox("Filters", options=("None","Blur","Detail","Emboss","Smooth","Sharpen","Contour","Edge Enhance","Gussian Blur","Brightness","Contrast","Colour Enhancement"))
s_btn=st.button("submit")
if s_btn:
edited=img.resize((width,height)).rotate(degree)
filtered=edited
if filters != "None":
if filters == "Blur":
blur_radius = st.slider("Blur Radius",0,10)
filtered=edited.filter(BLUR)
elif filters == "Detail":
detail_radius = st.slider("Detail Radius",0,10)
filtered=edited.filter(DETAIL)
elif filters == "Emboss":
emboss_radius= st.slider("Embose Radius",0,10)
filtered=edited.filter(EMBOSS)
elif filter == "Smooth":
smooth_amount=st.slider("Smooth Amount",0,10)
filtered=edited.filter(SMOOTH)
elif filter == "Sharpen":
sharpen_radius =st.slider("Sharpen Radius",0,10)
filtered=edited.filter(SHARPEN)
elif filter == "Brightness":
brightness_factor =st.slider("Brightness Factor",0.0,3.0,1.0)
enhancer = ImageEnhance.Brightness(edited)
filtered=enhancer.enhance(brightness_factor)
elif filter == "Contrast":
contrast_factor = st.slider("Contrast Factor", 0.0, 3.0, 1.0)
enhancer = ImageEnhance.Contrast(edited)
filtered = enhancer.enhance(contrast_factor)
elif filter == "Color Enhancement":
red_factor = st.slider("Red Factor", 0.0, 3.0, 1.0)
green_factor = st.slider("Green Factor", 0.0, 3.0, 1.0)
blue_factor = st.slider("Blue Factor", 0.0, 3.0, 1.0)
Environment data
Steps to reproduce
import streamlit as st
from PIL import Image
from PIL.ImageFilter import *
from PIL import ImageEnhance
st.markdown("
Image Editor
",unsafe_allow_html=True)st.markdown("---")
image=st.file_uploader("upload Image",type=["jpg","png","jpeg"])
info=st.empty()
size=st.empty()
mode=st.empty()
format_=st.empty()
if image:
img = Image.open(image)
info.markdown("
Information
",unsafe_allow_html=True)size.markdown(f"
size: {img.size}
",unsafe_allow_html=True)mode.markdown(f"
mode: {img.mode}
",unsafe_allow_html=True)format_.markdown(f"
format: {img.format}
",unsafe_allow_html=True)st.markdown("
Resizing
",unsafe_allow_html=True)width=st.number_input("width",value=img.width)
height=st.number_input("height",value=img.height)
st.markdown("
Rotation
",unsafe_allow_html=True)degree=st.number_input("degree",)
st.markdown("
Filters
",unsafe_allow_html=True)filters = st.selectbox("Filters", options=("None","Blur","Detail","Emboss","Smooth","Sharpen","Contour","Edge Enhance","Gussian Blur","Brightness","Contrast","Colour Enhancement"))
s_btn=st.button("submit")
if s_btn:
edited=img.resize((width,height)).rotate(degree)
filtered=edited
if filters != "None":
if filters == "Blur":
blur_radius = st.slider("Blur Radius",0,10)
filtered=edited.filter(BLUR)
elif filters == "Detail":
detail_radius = st.slider("Detail Radius",0,10)
filtered=edited.filter(DETAIL)
elif filters == "Emboss":
emboss_radius= st.slider("Embose Radius",0,10)
filtered=edited.filter(EMBOSS)
elif filter == "Smooth":
smooth_amount=st.slider("Smooth Amount",0,10)
filtered=edited.filter(SMOOTH)
elif filter == "Sharpen":
sharpen_radius =st.slider("Sharpen Radius",0,10)
filtered=edited.filter(SHARPEN)
elif filter == "Brightness":
brightness_factor =st.slider("Brightness Factor",0.0,3.0,1.0)
enhancer = ImageEnhance.Brightness(edited)
filtered=enhancer.enhance(brightness_factor)
elif filter == "Contrast":
contrast_factor = st.slider("Contrast Factor", 0.0, 3.0, 1.0)
enhancer = ImageEnhance.Contrast(edited)
filtered = enhancer.enhance(contrast_factor)
elif filter == "Color Enhancement":
red_factor = st.slider("Red Factor", 0.0, 3.0, 1.0)
green_factor = st.slider("Green Factor", 0.0, 3.0, 1.0)
blue_factor = st.slider("Blue Factor", 0.0, 3.0, 1.0)
Expected behavior
import streamlit as st
from PIL import Image
from PIL.ImageFilter import *
from PIL import ImageEnhance
st.markdown("
Image Editor
",unsafe_allow_html=True)st.markdown("---")
image=st.file_uploader("upload Image",type=["jpg","png","jpeg"])
info=st.empty()
size=st.empty()
mode=st.empty()
format_=st.empty()
if image:
img = Image.open(image)
info.markdown("
Information
",unsafe_allow_html=True)size.markdown(f"
size: {img.size}
",unsafe_allow_html=True)mode.markdown(f"
mode: {img.mode}
",unsafe_allow_html=True)format_.markdown(f"
format: {img.format}
",unsafe_allow_html=True)st.markdown("
Resizing
",unsafe_allow_html=True)width=st.number_input("width",value=img.width)
height=st.number_input("height",value=img.height)
st.markdown("
Rotation
",unsafe_allow_html=True)degree=st.number_input("degree",)
st.markdown("
Filters
",unsafe_allow_html=True)filters = st.selectbox("Filters", options=("None","Blur","Detail","Emboss","Smooth","Sharpen","Contour","Edge Enhance","Gussian Blur","Brightness","Contrast","Colour Enhancement"))
s_btn=st.button("submit")
if s_btn:
edited=img.resize((width,height)).rotate(degree)
filtered=edited
if filters != "None":
if filters == "Blur":
blur_radius = st.slider("Blur Radius",0,10)
filtered=edited.filter(BLUR)
elif filters == "Detail":
detail_radius = st.slider("Detail Radius",0,10)
filtered=edited.filter(DETAIL)
elif filters == "Emboss":
emboss_radius= st.slider("Embose Radius",0,10)
filtered=edited.filter(EMBOSS)
elif filter == "Smooth":
smooth_amount=st.slider("Smooth Amount",0,10)
filtered=edited.filter(SMOOTH)
elif filter == "Sharpen":
sharpen_radius =st.slider("Sharpen Radius",0,10)
filtered=edited.filter(SHARPEN)
elif filter == "Brightness":
brightness_factor =st.slider("Brightness Factor",0.0,3.0,1.0)
enhancer = ImageEnhance.Brightness(edited)
filtered=enhancer.enhance(brightness_factor)
elif filter == "Contrast":
contrast_factor = st.slider("Contrast Factor", 0.0, 3.0, 1.0)
enhancer = ImageEnhance.Contrast(edited)
filtered = enhancer.enhance(contrast_factor)
elif filter == "Color Enhancement":
red_factor = st.slider("Red Factor", 0.0, 3.0, 1.0)
green_factor = st.slider("Green Factor", 0.0, 3.0, 1.0)
blue_factor = st.slider("Blue Factor", 0.0, 3.0, 1.0)
Actual behavior
import streamlit as st
from PIL import Image
from PIL.ImageFilter import *
from PIL import ImageEnhance
st.markdown("
Image Editor
",unsafe_allow_html=True)st.markdown("---")
image=st.file_uploader("upload Image",type=["jpg","png","jpeg"])
info=st.empty()
size=st.empty()
mode=st.empty()
format_=st.empty()
if image:
img = Image.open(image)
info.markdown("
Information
",unsafe_allow_html=True)size.markdown(f"
size: {img.size}
",unsafe_allow_html=True)mode.markdown(f"
mode: {img.mode}
",unsafe_allow_html=True)format_.markdown(f"
format: {img.format}
",unsafe_allow_html=True)st.markdown("
Resizing
",unsafe_allow_html=True)width=st.number_input("width",value=img.width)
height=st.number_input("height",value=img.height)
st.markdown("
Rotation
",unsafe_allow_html=True)degree=st.number_input("degree",)
st.markdown("
Filters
",unsafe_allow_html=True)filters = st.selectbox("Filters", options=("None","Blur","Detail","Emboss","Smooth","Sharpen","Contour","Edge Enhance","Gussian Blur","Brightness","Contrast","Colour Enhancement"))
s_btn=st.button("submit")
if s_btn:
edited=img.resize((width,height)).rotate(degree)
filtered=edited
if filters != "None":
if filters == "Blur":
blur_radius = st.slider("Blur Radius",0,10)
filtered=edited.filter(BLUR)
elif filters == "Detail":
detail_radius = st.slider("Detail Radius",0,10)
filtered=edited.filter(DETAIL)
elif filters == "Emboss":
emboss_radius= st.slider("Embose Radius",0,10)
filtered=edited.filter(EMBOSS)
elif filter == "Smooth":
smooth_amount=st.slider("Smooth Amount",0,10)
filtered=edited.filter(SMOOTH)
elif filter == "Sharpen":
sharpen_radius =st.slider("Sharpen Radius",0,10)
filtered=edited.filter(SHARPEN)
elif filter == "Brightness":
brightness_factor =st.slider("Brightness Factor",0.0,3.0,1.0)
enhancer = ImageEnhance.Brightness(edited)
filtered=enhancer.enhance(brightness_factor)
elif filter == "Contrast":
contrast_factor = st.slider("Contrast Factor", 0.0, 3.0, 1.0)
enhancer = ImageEnhance.Contrast(edited)
filtered = enhancer.enhance(contrast_factor)
elif filter == "Color Enhancement":
red_factor = st.slider("Red Factor", 0.0, 3.0, 1.0)
green_factor = st.slider("Green Factor", 0.0, 3.0, 1.0)
blue_factor = st.slider("Blue Factor", 0.0, 3.0, 1.0)
The text was updated successfully, but these errors were encountered: