New creation : Python image transcoder - by jmp42

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

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

Python support display.drawBitmap() : These are sprites with a single dot color.
You can draw each bitmap with a different color using display.setColor().
Tips: you can also superimpose Bitmaps of different colors…
Screen résult :
20231212_164045
The assets : spr1 spr2 spr3

1 Like
#  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”