Youtube (and by extension youtube-dl) recently started to give thumbnails in the *.webp format, instead of the *.jpg format. If you try to load the *.webp files into a gdk.Pixbuf using the gdk.PixbufNewFromFile() function you get an error:
Couldn’t recognize the image file format for file “4kberLzSvx0.webp”
You mean load the file as you load any binary file, and then convert it to an Image using the decode method in the webp-package, and from there to a PixBuf? I did not think of doing that, but I will try it…
Ok, that works, so now I have an image.Image and need to convert it to a gdk.PixBuf, which I can’t seem to do. But that is probably a question more suited for the GoTK3 team, so thanks for the help.
My backup solution, will be to to do something like that (but I will save it as a jpg and keep it until the user deletes the video, instead of deleting it immediately), but I would prefer to just read the webp, and not have to do the conversion thing. Hopefully the GoTK3-gang will suggest a solution, where I don’t need to convert. There might already be a function for that, that I just don’t know about.
It seems like GdkPixBuf does not support webp images. See response by GoTK3 here:
But there are some workarounds, including doing a conversion, by loading the image using the package mentioned above, and saving it down as a jpg, as we talked about above.