This commit is contained in:
2026-01-21 08:21:19 +01:00
parent 4733e1a1cc
commit fd6e7c44e1
46 changed files with 3165 additions and 456 deletions

24
frontend/remove_bg.py Normal file
View File

@@ -0,0 +1,24 @@
from PIL import Image
def remove_background(input_path, output_path):
try:
img = Image.open(input_path)
img = img.convert("RGBA")
datas = img.getdata()
newData = []
for item in datas:
# Change all white (also shades of whites)
# to transparent
if item[0] > 240 and item[1] > 240 and item[2] > 240:
newData.append((255, 255, 255, 0))
else:
newData.append(item)
img.putdata(newData)
img.save(output_path, "PNG")
print("Successfully removed background")
except Exception as e:
print(f"Error: {e}")
remove_background("c:\\Users\\timo\\Documents\\Websites\\website-monitor\\frontend\\public\\logo.png", "c:\\Users\\timo\\Documents\\Websites\\website-monitor\\frontend\\public\\logo.png")