commit b1e9bff8205682f304c88fe1e642d6426d3b5b29 Author: Pedro Sá Couto Date: Fri Oct 11 12:35:53 2019 +0200 done diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..4f45f15 Binary files /dev/null and b/.DS_Store differ 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")