I’m trying to display an image on the Pico Display, using the tutorial from Penguin Tutor - display animations
I start out by getting the width and height of the display, initializing a display_buffer as a bytearray( width * height * 2 ). I’ve created my raw 565 byte converted image. The program will read the raw file into the display_buffer. But when the display is updated the image shows only the bottom half on the top half of the display, and left side is on the right side of the screen, with the right edge of the image is in the middle of the display. And the bottom half of the display shows random noise.
I’ve also noticed when trying to set the all the bytes in the display_buffer to give a full display red color, the display only shows the red up to where noise starts showing as in the above image.
So I did some tests to see where the bytes within display_buffer are set. I cleared the display to all black using display.set_pen(0,0,0), then display.clear(). I then set the pen to full red display.set_pen(255,0,0) followed by display.setPixel(0,0). The Pico Display would show the top left pixel as red. So I then decided to check each byte within display_buffer array for any non-zero values, to print out the byte location and it’s value. I would suspect that display_buffer would have a value, but the first index to show a non-zero value was display_buffer with 248.
I would have assumed that the bytes in display_buffer would align with the pixels in the Pico Display.
Can anyone explain the relation between the bytes in display_buffer and the picodisplay?
Included is my sample code for examining changes in the buffer:
import picodisplay as display
width = display.get_width()
height = display.get_height()
display_buffer = bytearray(width * height * 2) # 2-bytes per pixel (RGB565)
print (“count:%d” % len(display_buffer))
for i in range( 0, (width * height * 2)):
x = display_buffer[i]
if (x != 0):
print( “i:%d %d” % (i,x))
Any help is appreciated. Thank you.