SDL_image: The first frame of an animation has the metadata for the animation

From 6d6ea5bae50ea7459b879131761751045b106b22 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 29 Apr 2026 08:43:17 -0700
Subject: [PATCH] The first frame of an animation has the metadata for the
 animation

---
 src/IMG_anim_decoder.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/IMG_anim_decoder.c b/src/IMG_anim_decoder.c
index 84459e83..73225eda 100644
--- a/src/IMG_anim_decoder.c
+++ b/src/IMG_anim_decoder.c
@@ -394,6 +394,13 @@ IMG_Animation *IMG_DecodeAsAnimation(SDL_IOStream *src, const char *format, int
         ++actualCount;
     }
 
+    // Copy animation metadata to the first surface
+    if (actualCount > 0) {
+        SDL_PropertiesID src_props = IMG_GetAnimationDecoderProperties(decoder);
+        SDL_PropertiesID dst_props = SDL_GetSurfaceProperties(frames[0]);
+        SDL_CopyProperties(src_props, dst_props);
+    }
+
     IMG_CloseAnimationDecoder(decoder);
     decoder = NULL;