From b1e9bff8205682f304c88fe1e642d6426d3b5b29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20S=C3=A1=20Couto?= Date: Fri, 11 Oct 2019 12:35:53 +0200 Subject: [PATCH] done --- .DS_Store | Bin 0 -> 6148 bytes identification_sticker.py | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 .DS_Store create mode 100644 identification_sticker.py diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..4f45f15fb3e14963c61aa224516125093f5de899 GIT binary patch literal 6148 zcmeHKu};H441IocC{a-g zNC7GEt$=?Y3f-}(*eAxPgCRx$;)Lliu49%U7EchHihUw8G)pQmsa8h}OFHwV)-@IT z#H7RGW}Z`TwmP9$+|GQ7a#)k7CX}!$3N^`JfZ^N5FNFNrAsm;1kFL BAs_$% literal 0 HcmV?d00001 diff --git a/identification_sticker.py b/identification_sticker.py new file mode 100644 index 0000000..334aece --- /dev/null +++ b/identification_sticker.py @@ -0,0 +1,38 @@ +from PIL import Image, ImageDraw, ImageFont +import socket +import datetime +import pprint +import geocoder + +#Color mode +#Widht and Heigh +#Background Color +img = Image.new('RGB', (1920, 1280), color = (255, 255, 255)) +fontsize = 40 +#Margin top of 10 and later on in the loop choose the leading +# leading = 10 + +#Raw input is determined here +place = geocoder.ip('me') +hostname = socket.gethostname() +ip = socket.gethostbyname(hostname) +date = datetime.date.today() + +font = ImageFont.truetype('/Library/Fonts/Times New Roman.ttf', fontsize) +draw = ImageDraw.Draw(img) + +for line in range(0, 4): + draw.text((10,10),"Where: " + str(place.latlng), font=font, fill=(0, 0, 0)) + draw.text((10,55),"Who: " + hostname, font=font, fill=(0, 0, 0)) + draw.text((10,100),"IP: " + ip, font=font, fill=(0, 0, 0)) + draw.text((10,145),"Date: " + str(date), font=font, fill=(0, 0, 0)) + +#Save the image - name, resolution, format, smapling, quality is maximum +img.save('sticker.png', dpi=(300,300), format='PNG', subsampling=0, quality=100) + +img01 = Image.open("sticker.png") +img02 = Image.open("logo.png") +r1, g1, b1 = img01.split() +r2, g2, b2 = img02.split() +merged = Image.merge("RGB", (r2, g1, b1)) +merged.save("merged.png")