Skip to content

Instantly share code, notes, and snippets.

@ryosms
Last active February 8, 2019 08:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryosms/01fb0a1b610e217f4cb423112062a185 to your computer and use it in GitHub Desktop.
Save ryosms/01fb0a1b610e217f4cb423112062a185 to your computer and use it in GitHub Desktop.
Create 'CONGRATULATIONS' image from [pixela](https://pixe.la) using [pixela2img](https://github.com/ryosms/pixela2img).
from pixela2img import Pixela2Img
from PIL import Image
converter = Pixela2Img()
congratul = converter.convert('ryosms', 'congratulations', date='20180210')
ations = converter.convert('ryosms', 'congratulations', date='20190216')
width = congratul.width + ations.width + 1
height = congratul.height
congratulations = Image.new('RGBA', (width, height), (255, 255, 255, 0))
pixel_size = 12 # include white space
crop_start = pixel_size * 4 + 1
crop_end = pixel_size * 19
congratulations.crop((crop_start, 0, width - crop_end, height)).save('congratulations.png')
# (left, top, right, bottom)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment