Sign In

animated gif helper scripts

618
7.7k
48
Updated: Oct 5, 2024
toolscript
Type
Other
Stats
2,716
Reviews
Published
Apr 2, 2023
Base Model
SD 1.5
Hash
AutoV2
45FCC33CA6
emberbyte's Avatar
emberbyte

On request, here's a script to turn your prompts into gifs.

I built this off the prompts_from_file gif that comes with the webui.

USAGE!

prompts_from_file_to_gif

if all you want is a script in the webui to turn a list of prompts into a gif, then this is the only file you need to worry about!

Grab the prompts_from_file_to_gif upload, unzip it, and put it into your webui/scripts directory, then restart your webui. You'll find it under the name "prompts from file or textbox with gif generation."

Step by step

  1. download prompts_from_file_to_gif as animatedGifHelper_promptsFromFileToGif.zip

  2. extract animatedGifHelper_promptsFromFileToGif.zip to webui/scripts

  3. you should now have the file prompts_from_file_to_gif.py in your a1111 webui/scripts directory

  4. start, or restart if it's already running, your a1111 webui

  5. open the webui in your browser, for me, that's http://127.0.0.1:7860/

  6. scroll down to the bottom where it says "Script" there's a drop down

  7. select from the drop down "Prompts from file or textbox with GIF generation"

  8. enter your prompts, one prompt per line into the "List of prompt inputs" box

  9. scroll up and click generate

That will generate a gif, using the prompts you chose in step seven. The "frame duration" box determines how long, in ms each frame/prompt is shown in the gif. ie. 100 is 100ms, which is 10fps.

For step 7, you also have the option to instead of entering into the box, you can click "Upload Prompt Inputs" and select a txt file with prompts, one prompt per line. For example, you might want to do that for the sample_promnpts file included on this page. To use that.

  1. download sample_promts as animatedGifHelper_samplePrompts.zip

  2. extract happy_face-prompts.txt from animatedGifHelper_samplePrompts.zip

  3. either copy paste the prompts into the box per step (7.) above, or upload that text file. Click generate.

Bonus: if you want the exact same results as me for the sample, you can extract happy_face-first_frame.png from animatedGifHelper_samplePrompts.zip, load the image in the "PNG Info" tab, send to txt2img, and then follow the instructions above. IMPORTANT: if you do this you need to select the script again, because send to txt2img will deselect it.

sample_prompts

Grab the sample_prompts_to_get_you_started upload, unzip it, and then you can either open it up, and copy paste into the box, or you can click the upload_prompts_here button in the script to select the txt file.

Each prompt needs to be on one line, so if you have a bunch of prompts, you need to move them each to their own line.

parameter_grabber

To help with that, I also uploaded the parameter_grabber script.

If you don't want to, then you don't need to worry about that, but what it does, is it has simple gui, and it grabs the parameter data for all of the images files in a given directory, with an option to remove new line characters, and to write only your prompts, one per line, to a file.

Helps a lot. You can generate your images, one at a time, not needing to worry about saving the gen data seperate, then just drag and drop them off the webui to a new folder when you find a new frame you like, and at the end, you can use the parameter_grabber script to build the generation file for you.

It's particularly useful for img2img, and so that's why I uploaded the prompts_from_file_for_batch script.

prompts_from_file_for_batch

drop it into your webui scripts directory, then, it again uses the prompts from file script as a base, but what this one does, is it applies the prompts in the list you give it to the files in your batch.

So, if you go to the img2img tab, select batch, and choose the image folder that you put all of your images in? You can use the prompts file you got from parameter_grabber for those images, and then do whatever you want, batch to those files. ControlNet them, change the resolution, change cfg, anything.

It does apply them in filename order, so line one, should apply to the first file in the batch, and so on.