Skip to content

Instantly share code, notes, and snippets.

@rajbot
Created August 8, 2012 19:36
Show Gist options
  • Save rajbot/3297958 to your computer and use it in GitHub Desktop.
Save rajbot/3297958 to your computer and use it in GitHub Desktop.
Curiosity Rover Pixel Logo
#!/usr/bin/env python
from PIL import Image, ImageDraw
k_pixel_size = 50
size = (10 * k_pixel_size, 10 * k_pixel_size)
curiosity_pels = [(2,2), (3,2), (4,2), (5,2), (6,2), (7,2),
(2,3), (3,3), (7,3),
(2,4), (3,4), (4,4), (6,4), (7,4),
(6,5), (7,5),
(3,6), (5,6), (7,6),
(2,7), (3,7), (4,7), (5,7), (6,7), (7,7),
]
def draw_pixels(img, pixels, color):
draw = ImageDraw.Draw(img)
for pixel in pixels:
top = pixel[0] * k_pixel_size
left = pixel[1] * k_pixel_size
draw.rectangle(
(top, left, top + k_pixel_size, left + k_pixel_size),
fill=color,
)
img = Image.new('RGBA', size, (0, 0, 0, 255))
pixel_color = (255, 255, 255, 0)
draw_pixels(img, curiosity_pels, pixel_color)
img.save('curiosity.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment