Admin
5 December 2023 07:08
1
Python image transcoder
CircuitPython Image Transcoder
This tool transcode your monochrome images (black and white) in Gamebuino META Circuit Python style. It recognizes the following image formats: PNG, GIF, JPG and BMP.
This tools is a modified version of original C++ Image Transcoder by Steph, cf Image Transcoder
See more
3 Likes
Hanski
6 December 2023 17:06
2
Good work! Just to note about one typo: “Circuit Python”
2 Likes
You have tested it ? It’s works now with color pictures ?
2 Likes
JMP
12 December 2023 15:24
4
1 Like
JMP
12 December 2023 15:40
5
# width 16, height 16, length 1
from gamebuino_meta import waitForUpdate, display, color
spr1 = ( b"\x10\x10"
b"\x00\x00\x00\x00\x00\x00\x00\x00\x08\x20\x04\x40\x0f\xe0\x1b\xb0"
b"\x3f\xf8\x2f\xe8\x28\x28\x06\xc0\x00\x00\x00\x00\x00\x00\x00\x00" )
spr2 = ( b"\x10\x10"
b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x40"
b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" )
spr3 = ( b"\x10\x10"
b"\x00\x00\x00\x00\x00\x80\x01\x00\x01\x00\x03\x80\x00\x00\x00\x00"
b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" )
# example usage
# display scale : 1, 2 ...
SCALE = 2
# display position :
px = 20
py = 10
while True:
waitForUpdate()
display.clear()
display.setColor( color.GREEN ) # Select sprite 1 color
display.drawBitmap( px, py, spr1, SCALE )
display.setColor( color.RED ) # Select sprite 2 color
display.drawBitmap( px, py, spr2, SCALE )
display.setColor( color.ORANGE ) # Select sprite 3 color
display.drawBitmap( px, py, spr3, SCALE )
Good work! Just to note about one typo: “Circuit Python”