Aamir commited on
Commit
b7831cd
·
verified ·
1 Parent(s): 9c63db3

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -0
app.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from PIL import Image, ImageEnhance
3
+
4
+ st.title("Image Editor App")
5
+
6
+ # Upload Image
7
+ uploaded_file = st.file_uploader("Upload an Image", type=["jpg", "jpeg", "png"])
8
+
9
+ if uploaded_file:
10
+ image = Image.open(uploaded_file)
11
+ st.image(image, caption="Uploaded Image", use_column_width=True)
12
+
13
+ # Brightness
14
+ brightness = st.slider("Brightness", 0.5, 3.0, 1.0)
15
+ enhancer = ImageEnhance.Brightness(image)
16
+ img_bright = enhancer.enhance(brightness)
17
+
18
+ # Sharpness
19
+ sharpness = st.slider("Sharpness", 0.5, 3.0, 1.0)
20
+ enhancer = ImageEnhance.Sharpness(img_bright)
21
+ img_sharp = enhancer.enhance(sharpness)
22
+
23
+ # Contrast
24
+ contrast = st.slider("Contrast", 0.5, 3.0, 1.0)
25
+ enhancer = ImageEnhance.Contrast(img_sharp)
26
+ img_final = enhancer.enhance(contrast)
27
+
28
+ # Show edited image
29
+ st.image(img_final, caption="Edited Image", use_column_width=True)
30
+
31
+ # Option to download the edited image
32
+ st.download_button("Download Edited Image", img_final.tobytes(), "edited_image.png", "image/png")