Skip to content

Instantly share code, notes, and snippets.

Last active February 2, 2018 15:47
What would you like to do?
Draw U-Boot icon
# U-Boot icon
# Copyright (c) 2018 Heinrich Schuchardt <>
# SPDX-License-Identifier: GPL-2.0+
from PIL import Image, ImageDraw, ImageFont
OPAQUE = (255,)
BLACK = (0,0,0)
RED = (255,0,0)
ORANGE = (255,128,0)
YELLOW = (255,255,0)
GREEN = (0,255,0)
DARK_BLUE = (0,0,128)
LIGHT_BLUE = (192,192,255)
# dark blue background
img ='RGBA', (200,120), DARK_BLUE + OPAQUE)
# get a drawing context
d = ImageDraw.Draw(img)
# Propeller
d.ellipse((35,55,43,75), BLACK)
d.ellipse((36,56,42,74), LIGHT_BLUE)
d.ellipse((35,75,43,95), BLACK)
d.ellipse((36,76,42,94), LIGHT_BLUE)
# Shaft
d.rectangle((35,73,100,77), BLACK)
# Periscope
d.ellipse((120,10,160,50), BLACK)
d.ellipse((121,11,159,59), YELLOW)
d.ellipse((130,20,150,40), BLACK)
d.ellipse((131,21,149,49), DARK_BLUE)
d.rectangle((135,10,160,50), DARK_BLUE)
d.ellipse((132,10,138,20), BLACK)
d.ellipse((133,11,139,19), RED)
# Rudder
d.ellipse((45,40,75,70), BLACK)
d.ellipse((46,41,74,69), ORANGE)
d.ellipse((45,80,75,109), BLACK)
d.ellipse((46,81,74,108), RED)
# Bridge
d.ellipse((100,30,120,50), BLACK)
d.ellipse((101,31,119,49), GREEN)
d.ellipse((140,30,160,50), BLACK)
d.ellipse((141,31,159,49), GREEN)
d.rectangle((110,30,150,50), BLACK)
d.rectangle((110,31,150,50), GREEN)
# Hull
d.ellipse((50,40,199,109), BLACK)
d.ellipse((51,41,198,108), LIGHT_BLUE)
# Port holes
d.ellipse((79,57,109,82), BLACK)
d.ellipse((80,58,108,81), LIGHT_BLUE)
d.ellipse((83,61,105,78), BLACK)
d.ellipse((84,62,104,77), YELLOW)
d.ellipse((119,57,149,82), BLACK)
d.ellipse((120,58,148,81), LIGHT_BLUE)
d.ellipse((123,61,145,78), BLACK)
d.ellipse((124,62,144,77), YELLOW)
d.ellipse((159,57,189,82), BLACK)
d.ellipse((160,58,188,81), LIGHT_BLUE)
d.ellipse((163,61,185,78), BLACK)
d.ellipse((164,62,184,77), YELLOW)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment