This repository was archived by the owner on Jan 8, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env python | ||
|
||
''' | ||
This basic example shows use of the Python Pillow library: | ||
sudo apt-get install pillow | ||
The tiny 8x8 chars in lofi.png are from Oddball: | ||
http://forums.tigsource.com/index.php?topic=8834.0 | ||
Licensed under Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. | ||
''' | ||
|
||
import UnicornHat as unicorn | ||
from PIL import Image | ||
import signal, numpy, time | ||
|
||
img = Image.open('lofi.png') | ||
|
||
for o_x in range(img.size[0]/8): | ||
for o_y in range(img.size[1]/8): | ||
|
||
for x in range(8): | ||
for y in range(8): | ||
pixel = img.getpixel(((o_x*8)+y,(o_y*8)+x)) | ||
print(pixel) | ||
r, g, b = int(pixel[0]),int(pixel[1]),int(pixel[2]) | ||
unicorn.set_pixel(x, y, r, g, b) | ||
unicorn.show() | ||
time.sleep(0.5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters