From b15578bc7c941483d8317ed9ae609ce18597a90f Mon Sep 17 00:00:00 2001 From: Domeniko Gentner Date: Sat, 7 Nov 2020 16:30:15 +0100 Subject: [PATCH] removed PIL --- painter/__init__.py | 9 --------- painter/painter.py | 40 ---------------------------------------- 2 files changed, 49 deletions(-) delete mode 100644 painter/__init__.py delete mode 100644 painter/painter.py diff --git a/painter/__init__.py b/painter/__init__.py deleted file mode 100644 index 652350e..0000000 --- a/painter/__init__.py +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# /********************************************************************************** -# * _author : Domeniko Gentner -# * _mail : code@tuxstash.de -# * _repo : https://git.tuxstash.de/gothseidank/tweet2png -# * _license : This project is under MIT License -# *********************************************************************************/ -from .painter import painter diff --git a/painter/painter.py b/painter/painter.py deleted file mode 100644 index 62f66f5..0000000 --- a/painter/painter.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# /********************************************************************************** -# * _author : Domeniko Gentner -# * _mail : code@tuxstash.de -# * _repo : https://git.tuxstash.de/gothseidank/tweet2png -# * _license : This project is under MIT License -# *********************************************************************************/ -from PIL import Image, ImageDraw, ImageFont -from pathlib import Path -from json import load as j_load - - -class painter: - - def __init__(self, twitter: str, handle: str): - # Load json - css = Path("css.json") - with css.open('r') as fp: - css = j_load(fp) - - # Size - img_size = (css['dimensions']['x'], css['dimensions']['y']) - - # Background color - background_color = (css["background"]['r'], css["background"]['g'], css["background"]['b']) - - # text options - text = css['text'] - color = (text['color']['r'], text['color']['g'], text['color']['b']) - font = text['font'] - size = text['size'] - - image = Image.new('RGB', img_size, background_color) - font = ImageFont.truetype(font) - - context = ImageDraw.Draw(image) - context.text((10, 10), handle, fill=color, font=font) - - image.save('test.png')