0.96" SPI Colour LCD (160x80) Breakout no images/gifs

Hello, I am new to breakout garden. After hours of setup, I managed to display some example files, the scrolling text, and shapes, I want to know how to setup images/gifs to display. What would I type in Thonny? do i need to edit the image.py/ gif.py files to tell the display where to find the files? i just specified image size in the image.py file. Or do i need to display image/gifs and type commands into terminal?

That’s been asked and an answer given on the forums, I’ll be darned if I can find one of those threads or posts with a search though? I do believe @Shoe knows how its done?
I could have sworn it was in the comments in the gif.py file but I couldn’t find it?
I “think” it goes something like this, from terminal you type
python3 /home/pi/pimoroni/st7735-python/examples/ yourgifsname gif.py
With your gif in the examples folder.

Err off the top of my head I think it is Python3 /home/pi/pimoroni/st7735-python/examples/gif.py yourgifsname.gif if you want to do it via the terminal.

If you want to write your own script to do it, like @alphanumeric said, pick the relevant part out of the gif.py script:

# Open the file and call it "image"
image = Image.open(image_file)

# Start at the first frame of the image
frame = 0

while True:
    try:
        # Get the next frame in the image
        image.seek(frame)
        # Show that frame on the display
        disp.display(image.resize((width, height)))
        # Increase the "frame" variable, so the next frame will be pulled next time
        frame += 1
        # Allow the image to show for a short period of time
        time.sleep(0.05)

    # When try to pull more frames than are in the image it gives an EOFERROR
    # Handle this by resetting the "frame" to 0 so the whole thing can run again
    except EOFError:
        frame = 0

thank you for your swift responses, the first thing i did was search thru the forums yesterday to see if someone had the same issue .

I copy and pasted the terminal message & put my script & file name in the terminal

Python3 /home/pi/pimoroni/st7735-python/examples/GIF.py JR.gif

only to get a message. bash: Python3: command not found

then i tried the following:

  • in a blank file i copied the important part of the gif script from this chat.
  • in the script i defined image w/ my file name
  • my gif file is in the example folder as JR.gif

im getting a error

Questions:

  1. do i use terminal to run the python script or thonny? for the other examples, sliding text/shapes thonny worked.
  2. in the script, do I define the width, height of the image in the screen?
  3. does this gif script apply to still images? or do i need a second script?

comments:

  1.  I want to display images and gifs
    
  2.  if possible do a slideshow of images with a timer on each image
    
  3.  i dont how to program i just purchased screens because I thought it was plug and play.

only to get a message. bash: Python3: command not found

In that case, use python in the command, not python3. Unfortunately some choices which the Python people made have made this a bit confusing.

im getting a error

OK, so to save you having to write all sorts of code every time you want to do the same thing Python has Modules, which are collections of code for doing common tasks. Image is part of the PIL module (PIL stands for Python Image Library). At the top of that script, type from PIL import Image to tell Python that you want to use that module.

  1. do i use terminal to run the python script or thonny? for the other examples, sliding text/shapes thonny worked.

I take it you’re running this directly on a Raspberry Pi? Normally you’d be able to use either, but I think the gif.py example is written specifically for use with the command line.

  1. if possible do a slideshow of images with a timer on each image

That should be possible, so lets get the images/animations showing individually first.

  1. i dont how to program i just purchased screens because I thought it was plug and play.

The Pi ecosystem is largely about learning to program, but there are loads of resources which can help you do this, written for people who have no background in programming. There are a lot of books available as hardcopy or free PDF, you might find the Raspberry Pi Beginner’s Guide 4th Edition useful. (After some hardware setup they look at programming with Scratch, and then Python. Scratch is really aimed at young kids, so you may be able to skip past that to the Python section.)

Right after installing a breakout, when I’m running examples to test it, I do it from Thonny.
Once I have the code I plan on using, and want it to just automatically run on boot up, I run the file from a terminal command via crontab.
If your going to do this
python /home/pi/pimoroni/st7735-python/examples/GIF.py JR.gif
Don’t edit the gif.py file. Just use it as it originally was.

Just to note, that python (and python3) commands should not be capitalised.

Ops, autocorrect got it before I put the code tags around it. Fixed now though.
Might want to also double check to see if the Pimoroni folder is pimoroni or Pimoroni.