I'm trying to create an Action or some sort of other automatic process in Photoshop that'll create 100 Animated-GIFs.

Basically I have 100 folders that contain 9 images each, and I need this Action/process to take the 9 images from each one of these folders and turn them into an animated GIF.

So the results will be the creation of 100 9-frame long animated GIFs, where each one is made from the 9-images sitting in a different folder.

One animated-GIF per 9-image Folder.

So the Action (or "process") needs to:

  1. Open the current folder
  2. Import the 9 images in that folder, placing each image in its own layer
  3. Open the Timeline window and place each of the 9 images as a single frame in the Timeline
  4. Set the duration of each frame to "No Delay", and finally
  5. Export the resulting animation as an Animated-GIF

I tried creating an Action in photoshop - but it didn't work. I'm seeing all sorts of options in Photoshop - there's "BATCH", there's "Scripts / Image Processor" - it's all quite confusing.

Anybody have any idea how to do this?

  • You'll need scripting most likely - for both the operating system (to select the image folder and open the images), and for Photoshop to create and save a GIF.
    – Scott
    Jul 10, 2023 at 22:38
  • I actually asked ChatGPT how to do it using Photoshop, and while the answer it gave was thorough and looked promising - it didn't work. So I'm doing it with pure Javascript. TLDR: going through a loop, importing the 9 frames and drawing them onto an HTML Canvas, then exporting the Canvas as an Animated-GIF... Works like a charm.
    – Sirab33
    Jul 11, 2023 at 3:06
  • 2
    ChatGPT often provides answers that, on the surface, appear viable.... but they are as often completely inaccurate. ChatGPT isn't "smart". It just parrots puzzle pieces it's spidered and tries to string them together to read the most "normal". But the pieces can be completely out of place. I'm frankly a bit surprised by how often I'm seeing people say they tried ChatGPT to solve some technical issue, as if ChatGPT actually understood anything and was capable of rational thought.
    – Scott
    Jul 11, 2023 at 3:11
  • Agreed. My experience with ChatGPT has been pretty awful. And yet I know some pros that use it with great results. So it's a mixed bag. I did solve one problem with it, but it was through my own gleaning of code it gave me. Meaning the code it gave me was wrong, but after several edits and tests was able to rewrite that code to do what I needed to do. So it did help in that sense. It's an interesting process...
    – Sirab33
    Jul 12, 2023 at 3:33
  • I think ‘pros’ might be a key word. If you know how to code you’ll look for what you need in the answer. If you don’t, you won’t be able to understand what’s wrong with the code Jul 12, 2023 at 4:27

1 Answer 1


The task here is simple if you know what to do and kinda impossible if you don't. "Older" Photoshop scripting is on the voodoo side of things because for most powerful functions it uses a very weird looking low-level Action Manager layer that's technically is Javascript but looks horrifying: I don't think it's possible to navigate in it without much knowledge. There's a new Framework (UXP) that's more modern but I'd argue it has a steeper learning curve for non-developers.

Anyway, just for the lulz I tried to use ChatGPT to see if it'll be helpful, and it is to some extend it was, but only when I knew what to ask, for example things like

  • Is it possible to record photoshop actions as javascript?
  • Is it possible to convert Photoshop Actions to javascript?
  • In Photoshop how can I open a folder of images with javascript?

And it was giving absolutely wrong answers, stuff like "Right-click on the action and select Export and select "JavaScript" as the file type." — this just doesn't exist. For opening a folder of images it gave me however a correct answer even though it took it longer to type in the answer than for me googling it manually.

Sorry for the long intro, to answer your question: I believe what you want is to have 4 things:

  1. basic JS knowledge;
  2. an Action that has all the steps you want: Create Frame Animation, Place an Image into File, Create new Frame, Set Delay, Save as an Animated Gif;
  3. a way to convert this action to code to have a loop;
  4. provide a folder of images for the loop;

Let's say you know a bit of JS and now you need to get code for all the steps of the Action. There are two options here:

Weeeeeell, there's also a third option. If you enable Developer Mode in the Photoshop Plugins preferences, you'll have a new Copy as Javascript button in the Actions Flyout menu. But this will copy UXP code (the new framework), that's outside of the scope of this answer.

I'll go with option 2. Here's my Action:

enter image description here

And here's the code that was generated by the Action To JS script: https://pastebin.com/7YAFnAjT

There's a lot of garbage in there but each step was saved as a function that we can reuse.

The algorithm for the script could be like this:

  1. we create a document of a specific size (or get the size from one of the frames);
  2. we get all the files from the folder;
  3. we place all files into the document, saving references for layers and hide them;
  4. we create the frame animation for the document;
  5. for each pasted layer (but the last), we unhide the layer, create a new frame, set delay, hide the layer;
  6. and we export the gif in the end;

And for simpler stuff like "create a document", JS Scripting Reference could be referenced.

Here's the result of all that above. The input folder:

enter image description here

The file after running the script:

enter image description here

the exported GIF:

enter image description here

  • Though to be honest this is a job for imagemagic
    – joojaa
    Jul 12, 2023 at 10:39
  • @joojaa I'd go with PIL but fair :) Jul 12, 2023 at 14:44
  • Imagemagik requires less computer savyness than using python. And its part of Photoshop install package (weird, huh) so one does not need to install anything. But yeah python is OK, one could also use any other scripting language.
    – joojaa
    Jul 12, 2023 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.