News icon

Kimi K3 is now available on Runpod

Creating an Animated GIF from an Existing Image with the Runpod Stable Diffusion Template

Learn how to create an animated GIF from a still image using the Runpod Stable Diffusion template, including inpainting techniques and gif frame stitching.

Creating an Animated GIF from an Existing Image with the Runpod Stable Diffusion Template

Many of you have probably seen this tutorial for creating a GIF image from a still artwork. Wondering how to do it with Runpod? Here's how!

Following similar steps, I've used our Stable Diffusion template to animate the river for this still image, but the possibilities are endless. Let's get creative and learn how I did it!

AI-generated animated scene of a lush green hillside with a tree beside a flowing river

1. If you don't already have a Pod instance with the Stable Diffusion template, select the Runpod Stable Diffusion template from the Runpod templates page and spin up a new Pod.

Runpod Templates page listing official templates like PyTorch 2 and Stable Diffusion with Deploy buttons
Runpod Secure Cloud GPU picker for the Stable Diffusion template with H100, L40, RTX 6000 Ada, and RTX 4090 options
Runpod deployment form for an RTX 4090 with Stable Diffusion template, disk sizes, SSH and Jupyter enabled
Runpod pricing summary for an RTX 4090 Stable Diffusion pod with GPU and disk costs and a Deploy button
Runpod confirmation screen saying the pod is being built, with My Pods and GPU Cloud buttons

2. Once the Pod is finished being built, select Connect via HTTP. This will take you to the dashboard we'll use to modify our original image and save the frames that will make up our GIF.

Runpod pod connection options with HTTP, Jupyter Lab, web terminal, and an SSH command

3. If you don't have an image to base your GIF off of yet, you can generate one under the txt2img tab by providing a prompt and clicking Generate.

Stable Diffusion web UI generating a fantasy countryside with a winding river through a grassy meadow

Otherwise, select the img2img tab, choose the inpaint option, and upload your image.

Stable Diffusion web UI img2img tab on Inpaint with an empty drop-image upload area
Stable Diffusion web UI img2img tab with a green forest landscape loaded for inpainting

4. With the inpaint tool, carve out the are you'd like to animate, and type a prompt that Stable Diffusion will use to re-draw the carved out area.

I provided a negative prompt as well, so it would avoid generating things like new rocks in the middle of the river.
I provided a negative prompt as well, so it would avoid generating things like new rocks in the middle of the river.

5. Before you generate, scroll down and make sure to increase the batch size to generate more than one image at a time; that way, you can choose the best of the bunch to go into your GIF.
Like the original tutorial suggests, turning the denoising strength down (below ~0.25) and the CFG scale helps as well; this turns down the "creativity" and makes the output image less different than the original.

These are the arguments I provided.
These are the arguments I provided.

6. Generate! You may need to generate a few times or tweak the settings to get the exact results you're looking for. When you see a frame you like, select Save and click download to save it to your machine.

Stable Diffusion web UI output panel showing a generated forest stream image with seed and sampler details

7. Once you have all the frames you want to include for your GIF, all you need to do is stitch them together. I've also used ezgif with these settings to get the job done:

Animated GIF Maker web tool with six landscape frames, delay settings, and a crossfade frames option

And we're done! Here again is my final result:

AI-generated animated scene of a lush green hillside with a tree beside a flowing river

Give it a try, and be creative!

Author profile: Brandon Ikeler

Related articles

View All
Make the model yours

Make the model yours

Customizability is the most underrated idea in AI right now. Runpod CEO Zhen Lu on why a model tuned on your data beats a bigger one on the job you actually have.

All

Build what’s next.

Build, train, and scale AI workloads on Runpod with cloud GPUs, Serverless, and Clusters.

Star field background