Comments (2)
Just had an idea, would it be possible to just create a sinuglar frame canvas instead, and just utilize PILs "SetImage" functionality like this:
gif = Image.open(f"{self.webappRootDir}/basic-flask-app/static/gifs/{gifName}")
directory = os.fsencode(f"{self.matrixRootDir}/saved-gifs/{gifName}")
numberOfFrames = len([f for f in os.listdir(directory)if os.path.isfile(os.path.join(directory, f))])
canvas = self.matrix.CreateFrameCanvas()
for frameFileNumber in range(numberOfFrames):
canvas.SetImage(Image.open(f"{self.matrixRootDir}/saved-gifs/{gifName}/frame_{frameFileNumber}.bmp"))
canvases.append(canvas)
self.gifFileCanvases[gifName] = [canvases, gif.info['duration']]
gif.close()
print(f"Loaded GIF Data from File: {gifName}")
Then when rendering the GIFS I can just iterate each frame and run:
for frame in canvases:
matrix.SetImage(frame)
Where "frame" is a "FrameCanvas" object we created when processing the GIF before?
from rpi-rgb-led-matrix.
Ok, update. I tried the above, and it partially works.
I now create just a sinuglar canvas object with matrix.CreateFrameCanvas(), and then save the bitmap files as usual (like shown above), and then when rendering each GIF, I first load all the BMP with Image.open(), passing each BMP file (each frame of the GIF) as an argument, then saving all the results of Image.open() into a list. So I end up with a list of Image objects (each object represents a frame of the GIF)
Then, when rendering, I iterate that list of Image objects and run:
self.canvas.SetImage(listOfImages[frameNumber])
self.matrix.SwapOnVSync(self.canvas, framerate_fraction=framerateFraction)
This works, but produces noticeable flickering when the GIF restarts (as I play them 5 times each).
Any ideas? I just have the rendering code wrapped in a for i in range (5)
loop for playing them 5 times.
from rpi-rgb-led-matrix.
Related Issues (20)
- supporting panels of with broken color orders in the middle of a chain. HOT 1
- API question: can one write directly into the framebuffer used for display? HOT 11
- [Q&A] SwapOnVSync can lose order when using multithreading? HOT 2
- [Q&A] Is /dev/mem a security risk? HOT 1
- [Q&A] Dot Correction available at some point? HOT 2
- Error loading font using systemd python service (Bookworm) HOT 11
- Problem turning off audio in /boot.congig.txt - Pi 4 Model B HOT 2
- Example code demo D3 not working properly HOT 2
- 64 x 64 LED matrix HOT 4
- Panel P3 64x64 IC SM16208 SM5166 with matrix bonnet HOT 4
- Error with fornt when running venv code as root user -- Similar to #1682 HOT 10
- Flickering at regular intervals HOT 17
- really silly question for noob :( HOT 1
- i am using P10-3535-32x16-4s(AHH) . i have some problem or issue with module. HOT 1
- Need help with audio modules HOT 1
- c# HOT 2
- RPI5 support HOT 1
- Alternating between Images and GIFS - glitching at regular intervals
- 64x64 panel, every pair of lines are blank HOT 2
- ArchLinux arm working, but message at startup HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rpi-rgb-led-matrix.