Which local workflow to use for import GIFs in Godot?

Godot Version

4.6.1

Question

I like using GIFs in my games, especially to easily add tutorials, and I am looking for the standard ways to import them into Godot for a local workflow since Godot doesn’t support the format natively.

I found that one way is to export them as one big spritesheet, but I haven’t figured out how to do it with ImageMagick yet. I haven’t managed to get any editor plugins working either. For the moment, I use ezgif.com, but I am looking for a local software or a way to do it on my machine.

Any advice on the best way to handle this?

You can use image magick; here’s a shell script to expand the gif into individual image sequence, then combine back into a spritesheet via montage

#!/bin/bash
mkdir -p frames
convert -coalesce "$1" frames/%03d.png
montage -geometry +0+0 -tile 10x frames/*.png "$1".png

If you are using gifs for tutorials and they are quite big, maybe converting to OGV and using video player nodes would be better? You could use ffmpeg for that

ffmpeg -i "$1" -q:v 6 -q:a 6 -g:v 64 "$1".ogv

Thank you!

In case it’s useful for anyone, my scripts on Windows :

$GifFilename = $args[0]
if (Test-Path frames) { Remove-Item -Recurse frames -Force }
mkdir frames
magick "$GifFilename" -coalesce frames/%03d.png
magick montage -geometry +0+0 -tile 10x "frames/*.png" "$GifFilename.png"
$GifFilename = $args[0]
ffmpeg -i "$GifFilename" -q:v 6 -q:a 6 -q:v 64 "$GifFilename.ogv"
1 Like