Skip to content

PNG file don't show properly. (wrong order in index?) #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
riffnshred opened this issue Oct 31, 2023 · 1 comment
Closed

PNG file don't show properly. (wrong order in index?) #74

riffnshred opened this issue Oct 31, 2023 · 1 comment

Comments

@riffnshred
Copy link

I've found a bug when I upload a PNG file. The image load as the right size but the index of color seems to be all over the place.

I tested both PNG and BMP and the BMP file works great.

# SPDX-FileCopyrightText: 2020 Jeff Epler for Adafruit Industries
#
# SPDX-License-Identifier: MIT

# This example implements a simple two line scroller using
# Adafruit_CircuitPython_Display_Text. Each line has its own color
# and it is possible to modify the example to use other fonts and non-standard
# characters.

import adafruit_display_text.label
import board
import time
import ulab
import displayio
import framebufferio
import rgbmatrix
import terminalio
import adafruit_imageload

displayio.release_displays()

matrix = rgbmatrix.RGBMatrix(
    width=64, height=32, bit_depth=3,
    rgb_pins=[
        board.MTX_R1,
        board.MTX_G1,
        board.MTX_B1,
        board.MTX_R2,
        board.MTX_G2,
        board.MTX_B2
    ],
    addr_pins=[
        board.MTX_ADDRA,
        board.MTX_ADDRB,
        board.MTX_ADDRC,
        board.MTX_ADDRD
    ],
    clock_pin=board.MTX_CLK,
    latch_pin=board.MTX_LAT,
    output_enable_pin=board.MTX_OE,
)

display = framebufferio.FramebufferDisplay(matrix)

# load png image
image, palette = adafruit_imageload.load("ANA.png")

print(f"Logo is {image.width}x{image.height}")

# make tilegrid for the loaded image
tile_grid = displayio.TileGrid(image, pixel_shader=palette)

print(f"TileGrid is {image.width}x{image.height}")

# Put each line of text into a Group, then show that group.
g = displayio.Group()

# add loaded image tilegrid
g.append(tile_grid)
display.show(g)

# You can add more effects in this loop. For instance, maybe you want to set the
# color of each label to a different value.
while True:
    display.refresh(minimum_frames_per_second=0)

PNG version

20231031_085443

BMP version
20231031_085429

@deshipu
Copy link
Contributor

deshipu commented Aug 3, 2024

I think this is the result of adafruit/circuitpython#6675

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants