I'm trying to have a jpeg image I've downloaded displayed on a screen. I'm executing the below code on a raspberry pi that'll display the shapes & image on a waveshare display. For the life of me, I can't figure this one out. For example, I've looked into the PIL library, but that's only for Windows. I've tried editing the below code. That also doesn't work. I'd greatly appreciate any code that'll help me display a jpeg image. Thank you.

import epd7in5b
import Image
import ImageDraw
import ImageFont
#import imagedata


def main():
    epd = epd7in5b.EPD()

    # For simplicity, the arguments are explicit numerical coordinates
    image = Image.new('L', (EPD_WIDTH, EPD_HEIGHT), 255)    # 255: clear the frame
    draw = ImageDraw.Draw(image)
    font = ImageFont.truetype('/usr/share/fonts/truetype/freefont/FreeMonoBold.ttf', 24)
    draw.rectangle((0, 6, 640, 40), fill = 127)
    draw.text((200, 10), 'UNIT INFORMATION', font = font, fill = 255)
    draw.rectangle((200, 80, 600, 280), fill = 127)
    draw.chord((240, 120, 580, 220), 0, 360, fill = 255)
    draw.rectangle((20, 80, 160, 280), fill = 0)
    draw.chord((40, 80, 180, 220), 0, 360, fill = 127)

    image = Image.open('uno.bmp')

    # You can get frame buffer from an image or import the buffer directly:

if __name__ == '__main__':
  • What specific error do you get with this code?
    – Brick
    Feb 6, 2018 at 17:42

1 Answer 1


A method that would work on the Raspberry Pi would be to create a simple GUI to display the image. There is a nice Python library called appJar that allows you to make tkinter GUIs.

from appJar import gui

with gui("Image") as app:
    app.addImage("title", "image.jpg")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.