display .jpg in tiny led with PIL - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: display .jpg in tiny led with PIL (/thread-4716.html) |
display .jpg in tiny led with PIL - tony1812 - Sep-04-2017 Hello, I have this simple code that draw a line of text to this SSD1306 tiny led. #in python 3 # import libraries import RPi.GPIO as GPIO import time import Adafruit_GPIO.SPI as SPI # p2 syntax #import Adafruit_SSD1306 # p3 syntax from Adafruit_Python_SSD1306 import Adafruit_SSD1306 from PIL import Image from PIL import ImageDraw from PIL import ImageFont from PIL import ImageEnhance RST = None # 128x64 display with hardware I2C: disp = Adafruit_SSD1306.SSD1306_128_64(rst=RST) # Initialize library. #disp.begin() #optional # Clear display. #disp.clear() #optional #disp.display() #optional # Create blank image for drawing. # Make sure to create image with mode '1' for 1-bit color. width = disp.width height = disp.height image = Image.new('1', (width, height)) # Get drawing object to draw on image. draw = ImageDraw.Draw(image) # Draw a black filled box to clear the image. #draw.rectangle((0,0,width,height), outline=0, fill=0) #draw a text #font = ImageFont.truetype("media/text/fonts/" + font + ".ttf", fontsize, encoding="unic") draw.text((0,16), "python 3", fill=255) disp.image(image) disp.display() time.sleep(.01)I works well. I also have a 128x64 gragy scale ,jpg image. how can I display that image on this led screen? Thanks |