File size: 1,653 Bytes
ab2b59d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
750d172
 
 
50a42c6
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from ..modules import home_page
import os


def get_file_path(uploaded_file):
    if not os.path.exists("temp"):
        os.makedirs("temp")
    file_path = os.path.join("temp", uploaded_file.name)
    with open(file_path, "wb") as f:
        f.write(uploaded_file.getbuffer())
    return file_path

def display_converted_image(st, option, file_path):

    if option =="change_to_rgb":
        file = home_page.change_image_color_format(file_path,"RGB")
        st.image(file, width=500)
    elif option == "change_to_bgr":
        file = home_page.change_image_color_format(file_path,"BGR")
        st.image(file, width=500)
    elif option == "change_to_grayscale":
        file = home_page.change_image_color_format(file_path,"Grayscale")
        st.image(file, width=500)
    elif option == "rotate":
        angle = st.slider("Select Rotation Angle", min_value=0, max_value=360, value=0, step=1)
        if angle:
            file = home_page.change_image_color_format(file_path,"Rotate",angle)
            st.image(file, width=500)
    elif option == "increase_brightness":
        brightness_factor = st.slider("Select Brightness Factor", min_value=0.5, max_value=3.0, value=1.2, step=0.1)
        file = home_page.change_image_color_format(file_path,"increase_brightness",factor=brightness_factor)
        st.image(file, caption="Brightened Image", width=500)
    elif option == "blur_image":
        file = home_page.change_image_color_format(file_path,"Blur_Image")
        st.image(file, width=500)
    elif option == "resize_image":
        file=home_page.change_image_color_format(file_path,"resize_image")
        st.image(file, width=500)