Error in image-example.cc animated gif

image-example is not properly displaying animated images (GIFs). The RGBMatrix canvas constantly gets overwritten without being cleared so you get a jumbled image on the matrix.

The fix is:

diff --git a/examples-api-use/image-example.cc b/examples-api-use/image-example.cc
index 8788e78..09042b2 100644
--- a/examples-api-use/image-example.cc
+++ b/examples-api-use/image-example.cc
@@ -102,6 +102,7 @@ void ShowAnimatedImage(const ImageVector &images, RGBMatrix *matrix) {
   while (!interrupt_received) {
     for (const auto &image : images) {
       if (interrupt_received) break;
+      offscreen_canvas->Clear();
       CopyImageToCanvas(image, offscreen_canvas);
       offscreen_canvas = matrix->SwapOnVSync(offscreen_canvas);
       usleep(image.animationDelay() * 10000);  // 1/100s converted to usec

Cheers,
Dave

1 Like

thanks. You should send a pull request to get that fixed