Skip to content

Commit f15c657

Browse files
committed
pngdec example for inky
1 parent f3b53b6 commit f15c657

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
from picographics import PicoGraphics, DISPLAY_INKY_FRAME as DISPLAY # 5.7"
2+
# from picographics import PicoGraphics, DISPLAY_INKY_FRAME_4 as DISPLAY # 4.0"
3+
# from picographics import PicoGraphics, DISPLAY_INKY_FRAME_7 as DISPLAY # 7.3"
4+
import pngdec
5+
6+
# Create a PicoGraphics instance
7+
graphics = PicoGraphics(DISPLAY)
8+
9+
# Set the font
10+
graphics.set_font("bitmap8")
11+
12+
# Create an instance of the PNG Decoder
13+
png = pngdec.PNG(graphics)
14+
15+
# Clear the screen
16+
graphics.set_pen(1)
17+
graphics.clear()
18+
graphics.set_pen(0)
19+
20+
# Few lines of text.
21+
graphics.text("Display PNG Image...", 10, 40, 300, 3)
22+
graphics.text("Success!", 10, 70, 300, 3)
23+
24+
# Open our PNG File from flash. In this example we're using a green check mark.
25+
# You can use Thonny to transfer PNG Images to your Inky Frame.
26+
png.open_file("success.png")
27+
28+
# Decode our PNG file and set the X and Y
29+
png.decode(130, 70)
30+
31+
# Start the screen update
32+
graphics.update()
1.04 KB
Loading

0 commit comments

Comments
 (0)