0

im trying to play animated image to SDL2, my code works with animated gifs and static, if i add a static webp image works fine to, but if i add an animated webp, console gives me message fail to decode. I get the SDL2 last release with libwebp-7.dll, then i compiled webp to get libs and dlls libwebpdecoder.dll/lib and libwebpdemux.dll/lib, i dont know if i have wrong name of dlls as i get libwebp.dll and sdl_image release has libwebp-7.dll.

I´m using VS2019, i try compile using website example and vs2019 console.

i dont know if is need compile sdl_image with external options, and if so dont know how compile it to add webp/extra (folder with sdl code files) on windows.

#include <SDL.h> 
#include <SDL_image.h>
#include<iostream>
#include <decode.h>
#include <demux.h>
#include "SDL_endian.h"

SDL_Window* window;
SDL_Renderer* renderer;
IMG_Animation* anim;
SDL_Texture** textures;

//anim = IMG_LoadAnimation("logo.gif");  // works for animated gif our static
anim = IMG_LoadAnimation("anim.webp"); // works for static but for 

CONSOLE MESSAGE : Couldn't load Failed to decode WEBP: �w♥☺

RFS Vieira
  • 11
  • 1
  • Q: What is the exact error message??? Please [Edit] your post. Q: Have you been able to independently verify that the .webp is valid? For example, does your file render correctly in MS Edge? Q: Have you tried other, different .webp files with your SDL? *EDUCATED GUESS*: You probably have a valid file ... but it's probably a version that your libraries don't support yet. You'll need to do more troubleshooting to confirm this guess... – paulsm4 Nov 22 '22 at 04:15
  • Alredy edited, i take the images from -- https://cloudinary.com/blog/animated_webp_how_to_convert_animated_gif_to_webp_and_save_up_to_90_bandwidth -- tryed more than one diferente include from outher website, i think i need compile SDL_image with webp animated options, but im not figuring out how to do it, webp libary has an extra folder with sdl files. i really lost, Thanks – RFS Vieira Nov 22 '22 at 14:58
  • Thank you for the exact error message - it helps. Source code for the WebP loader is here: github.com/SDL-mirror/SDL_image/blob/master/IMG_webp.c. It looks like it's successfully reading the file info ... but fails here: `if ( features.has_alpha ) ret = lib.WebPDecodeRGBAInto() else ret = WebPDecodeRGBInto()`. I don't think there's anything wrong with your "build". It looks like the libraries you're using simply don't seem to support the files you're reading. – paulsm4 Nov 22 '22 at 18:25
  • Thanks, is strange because it has WebP animation functions in https://github.com/libsdl-org/SDL_image/blob/main/IMG_webp.c, as so in IMG_gif.c, I get the show anime.c as example to do my code. Oki, after read the source sdl_image.h found in line 2042 that the support for now is only for gif. Thanks I think we have to wait for new support hope soon as problably future is WebP format. Thanks again – RFS Vieira Nov 24 '22 at 03:05

0 Answers0