CallmeKaito commited on
Commit
37d9072
1 Parent(s): c64c178

fixed transparent black color in the flag

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -33,7 +33,9 @@ def process_image(image):
33
  palestine_bg = "https://flagdownload.com/wp-content/uploads/Flag_of_Palestine_Flat_Round-1024x1024.png"
34
  background_img = Image.open(BytesIO(requests.get(palestine_bg).content))
35
 
36
- background_img.putalpha(160)
 
 
37
 
38
  background_img = background_img.resize((image.width, image.height))
39
  #image = image.resize((background_img.width, background_img.height))
@@ -73,11 +75,8 @@ def main():
73
  cropped_pic = Image.open(io.BytesIO(cropped_pic))
74
  cropped_pic.save("cropped_pic.png")
75
 
76
- # Load input and background images
77
- background_img = cropped_pic
78
-
79
  # Process the images
80
- img = process_image(background_img)
81
 
82
  # Display the combined image
83
  st.image(img, caption="Combined Image", use_column_width=True)
 
33
  palestine_bg = "https://flagdownload.com/wp-content/uploads/Flag_of_Palestine_Flat_Round-1024x1024.png"
34
  background_img = Image.open(BytesIO(requests.get(palestine_bg).content))
35
 
36
+ # Create a semi-transparent overlay
37
+ overlay = Image.new('RGBA', background_img.size, (0, 0, 0, 120)) # Adjust the last value (120) to control transparency
38
+ background_img = Image.alpha_composite(background_img.convert('RGBA'), overlay)
39
 
40
  background_img = background_img.resize((image.width, image.height))
41
  #image = image.resize((background_img.width, background_img.height))
 
75
  cropped_pic = Image.open(io.BytesIO(cropped_pic))
76
  cropped_pic.save("cropped_pic.png")
77
 
 
 
 
78
  # Process the images
79
+ img = process_image(cropped_pic)
80
 
81
  # Display the combined image
82
  st.image(img, caption="Combined Image", use_column_width=True)