Jul-04-2019, 10:25 PM
(Jul-04-2019, 05:22 PM)noisefloor Wrote: Hi,
reading through the documentation, I guess thatlcd.set_pixel()
expects an 8-bit value forpixel
. When you read a JPG image, you get at least a tuple of three 8-bit values like(128, 255, 10)
for RGB. Thus, I guess you need to convert your image into one of gray shades first. I also guess that Pillow has a method for that. Just dig yourself through the documentation.
Regards, noisefloor
Hy thank you
my new script :
#!/usr/bin/env python import time from gfxhat import lcd, backlight, fonts from PIL import Image, ImageFont, ImageDraw print("""Message de demarrage""") backlight.set_all(240,240,240) backlight.show() lcd.clear() image = Image.open("/tmp/aa.jpg") for x in range(124): for y in range(64): pixel = int(image.getpixel((x, y))[0]) print(pixel) lcd.set_pixel(x, y, pixel) lcd.show()thanks to you i have understand the mechanism,
and i want to thank you a lot.