gif2gif is a script extension for Automatic1111’s Stable Diffusion Web UI. It accepts an animated gif as input, process the frames one by one and combines them back to a new animated gif. I am going to show you how to use the extension in this article.
Enable the Extension
- Click on the Extension tab and then click on Install from URL.
- Enter https://github.com/LonicaMewinsky/gif2gif.git in the URL box and click on Install.
- Click on Installed and click on Apply and restart UI.
- I am using a gif showing a Genshin Impact chacracter, Yelan, dancing. You can find the input file in the bottom of this article. The model I used is AbyssOrangeMix2. You can download the model and VAE here. However, this is not necessary – I think you can use any anime based model with it. I also used a Yelan LoRA model. You can download the LoRA model here, and the reference prompts here. If you don’t know how to use a LoRA model, please refer to my post about the topic.
- Click on the img2img tab.
- Enter the prompt and negative prompt according to the reference prompt.
- Drop the input gif file in the image box of img2img.
- Enter the parameters according to the following screenshot:
- Note that the original resolution for the image is too high for my computer to handle. Therefore, I reduced the resolution from 576×1024 to 432×768. As long as the aspect ratio is the same, it will work. The denoising strength is something you have to test different values for until you achieve the desired results. The lower the value, the smoother animation later on. However, when the strength is too low, the output image is almost the same as the input image, which defeats the purpose of generating a new gif. You have to experiment a bit to find a good denoising strength. I will show you some example outputs using different denoising strengths.
- Generate a few images and find one that you like. Enter the seed corresponding to the one you like in the Seed box in order to create similar results in subsequent frames of your animation.
- Scroll down and expand the Script dropdown and select gif2gif.
- Drop the input animated gif to the Upload GIF box.
- Click on Generate to start the process. Depending on the length of the animated gif, this could take minutes to hours. For my 7-second 25 frames per second (fps) video, it took about an hour for my AMD 6800M GPU.
- When it’s done, the gif is saved under the outputs/img2img-images/gif2gif sub folder of the webui folder.
Below are the input and sample outputs with different denoising strengths.
Output with denoising strength 0.25:
Output with denoising strength 0.35:
Output with denoising strength 0.5:
So, were you able to follow the instructions here and get good results? What denoising strength did you use? Also, if you need help converting a video file to an animated gif, I recommend this site. No signup is needed. The site also supports gif to video conversion. Give it a try and let me know what you think.
My other tutorials:
This post may contain affiliated links. When you click on the link and purchase a product, we receive a small commision to keep us running. Thanks.