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

bug #4190

Closed
3 tasks done
kjchset opened this issue Sep 26, 2024 · 0 comments
Closed
3 tasks done

bug #4190

kjchset opened this issue Sep 26, 2024 · 0 comments

Comments

@kjchset
Copy link

kjchset commented Sep 26, 2024

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues, especially the pinned issues.

Exception report

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)

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)

    st.image(filtered, caption='Processed Image', use_column_width=True)

Environment data

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)

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)

    st.image(filtered, caption='Processed Image', use_column_width=True)

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)

    st.image(filtered, caption='Processed Image', use_column_width=True)

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)

    st.image(filtered, caption='Processed Image', use_column_width=True)
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Sep 26, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot removed the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants