MCPcopy
hub / github.com/geekcomputers/Python / add_logo

Method add_logo

Image-watermarker/watermark.py:18–30  ·  view source on GitHub ↗
(self, image, logo, position=(0, 0))

Source from the content-addressed store, hash-verified

16 return image
17
18 def add_logo(self, image, logo, position=(0, 0)):
19 if logo.mode != "RGBA":
20 logo = logo.convert("RGBA")
21 if image.mode != "RGBA":
22 image = image.convert("RGBA")
23
24 if (position[0] + logo.width > image.width) or (
25 position[1] + logo.height > image.height
26 ):
27 CTkMessagebox(title="Logo position", message="Logo position out of bounds.")
28
29 image.paste(logo, position, mask=logo)
30 return image
31
32 def save_image(self, image):
33 save_path = filedialog.asksaveasfilename(

Callers 1

save_imageFunction · 0.80

Calls 2

convertMethod · 0.80
pasteMethod · 0.80

Tested by

no test coverage detected