Python Forum
display .jpg in tiny led with PIL
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
display .jpg in tiny led with PIL
#1
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Question [SOLVED] Tiny web server as standalone executable? Winfried 0 326 Feb-09-2024, 11:48 AM
Last Post: Winfried
  How to display <IPython.core.display.HTML object>? pythopen 3 45,918 May-06-2023, 08:14 AM
Last Post: pramod08728
Information Unable to display joystick's value from Python onto display box MelfoyGray 2 2,229 Nov-11-2020, 02:23 AM
Last Post: MelfoyGray

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020