I'm just trying to get into new world of RaspPi, Python etc. but facing situation where I am fully lost now and trying to find some guidance.
For my scenario, I connected an (RGB) LCD display in order to show some output from my software scripts. Even though I can get Texts and graphical objects on it, there is still an issue to show-up images like logo or other simple pictures.
I tried for several days now w/ different functions and examples but there is not break-through yet. As a quick 'n dirty code-line to get on the same track (this is just testing purposes - no productive usage!), please follow the example code lines herewith:
from PIL import Image, ImageFont
from luma.core.virtual import viewport
from demo_opts import get_device
from luma.core.render import canvas
from luma.core.interface.serial import spi
from luma.lcd.device import st7735
s = spi(port=0, device=0, cs_high=True, gpio_DC=23, gpio_RST=24)
device=st7735(s,rotate=0,width=160,height=128,h_offset=0,v_offset=0,bgr=False)
print ("Starting...")
img = Image.open("img/starwars.png")
img = img.resize((120,40),Image.BILINEAR)
screen = viewport(device, width=device.width, height=device.height)
while True:
for _ in range(2):
with canvas(screen) as draw:
draw.bitmap((20, 0), img) #works
draw.arc((20,20,50,50), 0, 90) #works
It works fine unless I am using the simple starwars.png. When using another file format (colored picture, different file format etc.), I'm faced w/ different kind of errors I could not yet resolve - e.g. bad transparency mask, no show-up. I'm aware that bitmap-function is tricky here, as it just forces a masking by pre-given image format. But I could not derive any other function yet to get any other image been shown on the LCD.
Question: Any idea how to move on? Where's the pitfall? Any tips for an beginner in that area? :)
Side note: I also tried to use this library and examples: https://github.com/pimoroni/st7735-python/blob/1a70d3ae7eee6f376de430c944ff4e95d294543e/examples/image.py However, using this code line, the LCD is not even triggered at all.
Thanks for any feedback for such a blind passenger and rookie :-)