Generating gifs that replay and controlling FPS in MATLAB
84 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I'm generating lots of figures representing a system and it would be useful to be if they were displayed in a GIF (so I don't have to keep clicking between them, they just skip automatically).
I'v been able to create a GIF using the exportgraphics command, the issues are:
1) it doesn't replay. After it has finished showing each image, it stops on the last image and thats it. I've tried saving and reloading, but the GIF stays stuck on the last image. I need to be able to save the file as a GIF to use with other software.
2) the FPS is really low. Ideally I'd like it to be about 50 frames over 2 seconds.
I'm using MATLAB online, I don't know if that helps
0 commentaires
Réponses (2)
Eshan Patel
le 4 Nov 2022
Hey William,
I see that you are using "exportgraphics" to create a GIF, and you require a better way to do it. You can address all the drawbacks you are currently facing by using the "imwrite" function, which will allow you to loop the GIF and add a custom delay to each frame.
0 commentaires
DGM
le 4 Nov 2022
I don't have exportgraphics(), so I can't experiment with it, and I'm not sure how you're using it.
Off the top of my head, I don't recall how the loopcount is specified in the file header for GIF. My suspicion is simply that the way the file is being incrementally constructed is creating a problem.
That said, I use these tools for creating animated GIFs from 4D image arrays. You might have to do some extra intermediate work to get the images in that form, but that's what I have at hand. That'll handle per-frame delay specification, and it's infinite-looping by default.
There are other GIF tools on the FEX, but those are the ones I'm familiar with (because I wrote them).
0 commentaires
Voir également
Catégories
En savoir plus sur File Operations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!