You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.2 KiB
Python

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")