Adafruit_CircuitPython_ImageLoad icon indicating copy to clipboard operation
Adafruit_CircuitPython_ImageLoad copied to clipboard

adafruit_imageload + PNG

Open 10der opened this issue 6 months ago • 3 comments

hi! I have a png file (source here https://developer.lametric.com/content/apps/icon_thumbs/52160)

Image

bit_depth=2

import board
import displayio
import rgbmatrix
import framebufferio
import adafruit_imageload

displayio.release_displays()

matrix = rgbmatrix.RGBMatrix(
    width=64, bit_depth=2,
    rgb_pins=[board.GP2, board.GP3, board.GP4, board.GP5, board.GP8, board.GP9],
    addr_pins=[board.GP10, board.GP16, board.GP18, board.GP20],
    clock_pin=board.GP11, latch_pin=board.GP12, output_enable_pin=board.GP13,
    doublebuffer=True)
display = framebufferio.FramebufferDisplay(matrix, auto_refresh=True,rotation=180)

display.rotation = 0

g = displayio.Group()
b, p = adafruit_imageload.load("images/w-rainy.png")
t = displayio.TileGrid(b, pixel_shader=p, x=20, y=10)
g.append(t)

display.root_group =  g

while True:
    pass

Image

some changes.... bit_depth=6

import board
import displayio
import rgbmatrix
import framebufferio
import adafruit_imageload

displayio.release_displays()

matrix = rgbmatrix.RGBMatrix(
    width=64, bit_depth=6,
    rgb_pins=[board.GP2, board.GP3, board.GP4, board.GP5, board.GP8, board.GP9],
    addr_pins=[board.GP10, board.GP16, board.GP18, board.GP20],
    clock_pin=board.GP11, latch_pin=board.GP12, output_enable_pin=board.GP13,
    doublebuffer=True)
display = framebufferio.FramebufferDisplay(matrix, auto_refresh=True,rotation=180)

display.rotation = 0

g = displayio.Group()
b, p = adafruit_imageload.load("images/w-rainy.png")
t = displayio.TileGrid(b, pixel_shader=p, x=20, y=10)
g.append(t)

display.root_group =  g

while True:
    pass

Image

so. my question is - what I am doing wrong?

10der avatar Jul 11 '25 17:07 10der

It's unclear what your question is. I can see in one photo that the transparent sections of the PNG are not working, but I can't tell under what conditions this succeeds or fails from your message.

The two blocks of code in your post appear to be identical, perhaps there was intended to be some difference between them?

Or are these two tests run with two different files that were exported with different configurations maybe?

If you can describe a bit more about what you are trying to do and your goal it may be easier to help

FoamyGuy avatar Jul 11 '25 18:07 FoamyGuy

It's unclear what your question is. I can see in one photo that the transparent sections of the PNG are not working, but I can't tell under what conditions this succeeds or fails from your message.

The two blocks of code in your post appear to be identical, perhaps there was intended to be some difference between them?

Or are these two tests run with two different files that were exported with different configurations maybe?

If you can describe a bit more about what you are trying to do and your goal it may be easier to help my FAIL!

first case: bit_depth=2, 2nd case: bit_depth=6

10der avatar Jul 11 '25 20:07 10der

If you can describe a bit more about what you are trying to do and your goal it may be easier to help just want to see my pic Image on the display https://www.waveshare.com/wiki/Pico-RGB-Matrix-P3-64x32

but as you can see no luck - palette is wrong.

10der avatar Jul 11 '25 20:07 10der