Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -63,13 +63,13 @@ if uploaded_file:
|
|
| 63 |
|
| 64 |
# Watermarking
|
| 65 |
if st.sidebar.checkbox("Add Watermark"):
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
|
| 74 |
# Enhance Image
|
| 75 |
enhancer = ImageEnhance.Brightness(image)
|
|
|
|
| 63 |
|
| 64 |
# Watermarking
|
| 65 |
if st.sidebar.checkbox("Add Watermark"):
|
| 66 |
+
watermark_text = st.sidebar.text_input("Watermark Text", "My Watermark")
|
| 67 |
+
draw = ImageDraw.Draw(image)
|
| 68 |
+
font = ImageFont.truetype("arial.ttf", 36) # Make sure this font exists or use ImageFont.load_default()
|
| 69 |
+
width, height = image.size
|
| 70 |
+
text_width, text_height = draw.textsize(watermark_text, font)
|
| 71 |
+
x, y = width - text_width - 10, height - text_height - 10
|
| 72 |
+
draw.text((x, y), watermark_text, font=font, fill=(255, 255, 255, 128))
|
| 73 |
|
| 74 |
# Enhance Image
|
| 75 |
enhancer = ImageEnhance.Brightness(image)
|