Spaces:
Runtime error
Runtime error
CallmeKaito
commited on
Commit
β’
cccb949
1
Parent(s):
c2f81f4
Update app.py
Browse files
app.py
CHANGED
@@ -36,10 +36,6 @@ def process_image(image):
|
|
36 |
palestine_bg = "https://flagdownload.com/wp-content/uploads/Flag_of_Palestine_Flat_Round-1024x1024.png"
|
37 |
background_img = Image.open(BytesIO(requests.get(palestine_bg).content))
|
38 |
|
39 |
-
# Create a semi-transparent overlay
|
40 |
-
# overlay = Image.new('RGBA', background_img.size, (0, 0, 0, 120)) # Adjust the last value (120) to control transparency
|
41 |
-
# background_img = Image.alpha_composite(background_img.convert('RGBA'), overlay)
|
42 |
-
|
43 |
background_img = background_img.resize((image.width, image.height))
|
44 |
#image = image.resize((background_img.width, background_img.height))
|
45 |
|
@@ -53,6 +49,10 @@ def process_image(image):
|
|
53 |
|
54 |
normal_img = Image.blend(image, background_img, .3).convert('RGB')
|
55 |
|
|
|
|
|
|
|
|
|
56 |
combined_img = Image.alpha_composite(input_img, background_img)
|
57 |
|
58 |
combined_img = combined_img.convert('RGB')
|
|
|
36 |
palestine_bg = "https://flagdownload.com/wp-content/uploads/Flag_of_Palestine_Flat_Round-1024x1024.png"
|
37 |
background_img = Image.open(BytesIO(requests.get(palestine_bg).content))
|
38 |
|
|
|
|
|
|
|
|
|
39 |
background_img = background_img.resize((image.width, image.height))
|
40 |
#image = image.resize((background_img.width, background_img.height))
|
41 |
|
|
|
49 |
|
50 |
normal_img = Image.blend(image, background_img, .3).convert('RGB')
|
51 |
|
52 |
+
# Create a semi-transparent overlay
|
53 |
+
overlay = Image.new('RGBA', background_img.size, (0, 0, 0, 120)) # Adjust the last value (120) to control transparency
|
54 |
+
background_img = Image.alpha_composite(background_img.convert('RGBA'), overlay)
|
55 |
+
|
56 |
combined_img = Image.alpha_composite(input_img, background_img)
|
57 |
|
58 |
combined_img = combined_img.convert('RGB')
|