Has anyone come across a project or library that would display and animated gif on a TFT LCD (controlled using an Adafruit library) stored on a sd card? Something like SmartMatrix but for a LCD?
I have always just created multiple images and then called those images to create the animation.
You can also create code that changes pixels at random or in some certain order to make your static image look like it’s animated.
Sure, that’s a possible solution, but I really like the idea of displaying animated gifs the way SmartMatrix can.
What is the difference?
Well. you have one GIF file instead of multiple image files.
I see, that would be easier but probably the same file size but maybe not.
@peekay123 would be the guy to ask about this.
@RWB, the way it’s done in SmartMatrix is way supperior to having to do it “manually”.
You just hand it one file and the rest is done for you using SD->DMA->screen (oversimplified ;-)) with stunning speed.
I think T H E guy to ask about this is @Pixelmatix
@ScruffR That does sound superior, and it sure would make creating Animations easier for the memory LCD’s I’m using.
I thought the SmartMatrix was just another LCD module with a built-in microprocessor that handles GIF animation conversion but now I see SmartMatrix is software
I think @peekay123 may be using this already in one of his demo files for the latest LED Matrix Panel where he displays animated GIF like images stored on the SD card. These are different than the Pacman animations, they are full motion GIF’s, but I can’t find that demo code where he is using this though.
Yup, that’s what Paul uses for the animated GIFs on the RGB Matrix Panel AFAIK.
Here is a repo that should contain something
(Sorry forgot the link at first )
Thanks a lot @ScruffR, this might be exactly what I was looking for. I will just go ahead and replace the RGB Matrix Panel with my own LCD and hopefully this will work:)
@tomajmich, the biggest challenge will be draw time. With a TFT, there is not enough RAM on the Photon to hold a display buffer. So drawing will need to be frame-by-frame, pixel-by-pixel which will be slow as molasses. You would need more RAM or a TFT with onboard screen buffer.
Thanks for the complement and the ping @ScruffR. Every time I work on the AnimatedGIFs sketch I try to make it more reusable. It’s not too far off from being an independent Arduino library that can be used with any graphics library.
Agreeing with Paul here, there’s not enough memory, and access to external memory is slow. To process a GIF you need two full color depth buffers for the previous frame and current frame. Assuming it’s a 16-bit LCD and there’s no access to the buffer on the LCD itself (usually the case for the TFTs I’ve seen), at the common size of 320*240 you need 300k of memory, way more than the Photon has and that’s not counting everything else you need to process a GIF or connect to the internet.
Or is it just best to animate via multiple separate images?
@Pixelmatix I know that this requires a lot of memory for such big LCD’s, but I don’t really need to display the gif on the entire screen. I would be satisfied with displaying the gif say in the middle and leave the rest black or display some text.
The AnimatedGIFs sketch is currently hardcoded to use rgb24 color, but if it were made more flexible, then using a lower color depth e.g. 1bpp would save memory. I don’t think there’s a “best” solution, there are always tradeoffs.
Thanks for the reply.
I’ll just stick to the old fashion way of doing it
OK, in that case you should be able to use the sketch as is. Replace the SmartMatrix-specific calls in the AnimatedGIFs sketch to the library you’re using. I haven’t tried it for GIFs larger than 64x64, so it may be quite slow, please post back and let us know how it’s working, or if you need more help.