-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathImageWatermarkingApp [GUI].py
67 lines (36 loc) · 1.45 KB
/
ImageWatermarkingApp [GUI].py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# GUI
from tkinter import *
root = Tk()
root.title("WATERMARKING APP")
root.geometry("1000x1000")
root.mainloop()
# # TEXT ON THE IMAGE (WATERMARK)
# from PIL import Image, ImageDraw, ImageFont
# # get an image
# with Image.open("Default.jpg").convert("RGBA") as base:
# # make a blank image for the text, initialized to transparent text color
# txt = Image.new("RGBA", base.size, (255, 255, 255, 0))
# # get a font
# fnt = ImageFont.truetype("C:/Windows.old/Windows/Fonts/times.ttf", size=80)
# # fnt = ImageFont.load_default()
# # get a drawing context
# d = ImageDraw.Draw(txt)
# # # draw text, half opacity
# # d.text((10, 10), "Hello", font=fnt, fill=(255, 255, 255, 128))
# # # draw text, full opacity
# # d.text((10, 80), "World", font=fnt, fill=(255, 255, 255, 255))
# # draw multiline text
# d.multiline_text((10, 10), "Hello\nWorld", font=fnt, fill=(250, 250, 250, 128))
# out = Image.alpha_composite(base, txt)
# out.show()
# BASIC LINE DRAW ON THE IMAGE
# # import sys
# from PIL import Image, ImageDraw, ImageShow
# with Image.open("Default.jpg") as im:
# draw = ImageDraw.Draw(im)
# draw.line((0, 0) + im.size, fill=128)
# draw.line((0, im.size[1], im.size[0], 0), fill=128)
# # write to stdout
# # im.save(sys.stdout, "PNG")
# # show image
# ImageShow.show(im, title=None)