ffmpeg is my go to for things like this but I can never remember the necessary incantation on the command line. Fortunately ChatGPT tends to get you most of the way there a lot of the time, I would normally asks something like the following and start from there:
How to convert a folder of png images into a gif using ffmpeg?
Op this is the guide you need! I’ll leave my link up as comparison in quality of the guide a knowledgable human produces vs that predicted by an ml model