Copy link to clipboard
Copied
Hi,
I am trying to mimic the action "Save for Web & Devices" of a PSD file, having 4 frames in an animation, into an animated GIF file.
I was suggested to use "ScriptingListener", but I did the copy/paste of the code, it did not work.
Is there a way to code a script, by using classes/functions to achieve this result ?
Thank you in advance.
Jean-Louis
Copy link to clipboard
Copied
You can create scripts using Javascript (and a couple of other choices) that has access to most features. So you could open a bunch of PNGs and copy them as layers to your PSD in the right order. But saving an animated gif in Photoshop required you to create and setup the timeline or the the animation option is not available. And timeline is something you can't access in Javascript so I would guess it's not possible in Javascript.
Personally I'd try to find some tool that can automatically convert a layered PSD file to animated gif and then make a script that compiles the layered PSD in the way you want.
Copy link to clipboard
Copied
Thank you, Matias !
So we can not access to the timeline / animation option in JavaScript,
the only way is to prepare all of them as layers and in correct order,
thus we can compile them all into animated GIF through script.
Is that correct ?
Copy link to clipboard
Copied
Yes that's my understanding for Javascript, with clarification that with "compile them all into animated GIF through script" using some external program (e.g. check out ImageMagick). Whether that is an OK solution depends on what you are trying to do (just for own internal use or distribution).
For the Javascript docs see http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/photoshop/pdfs/photoshop-cc-javascript-ref.pd...
Copy link to clipboard
Copied
Before concluding something is not possible with JavaScript in Photoshop please try and see if you can record code with ScriptingListener.plugin
Edit: The recorded code may seem incomprehensible at first but may actually be helpful nonetheless.
Copy link to clipboard
Copied
Yeah, Javascript and ScriptListener are two different worlds and usually you can do more with latter (in a bit more difficultly controlled manner). One issue might be that creating animated gifs in the Photoshop UI has changed at least in CS5, CS6 and CC. I.e. you might need different code for each.
Copy link to clipboard
Copied
Javascript and ScriptListener are two different worlds
How is Photoshop Action Manager (AM) code as opposed to Document Object Model (DOM) not JavaScript?
Copy link to clipboard
Copied
Just meant the way you access and manipulate the document is totally different. Certainly different rules apply to what can and cannot be done. Might be that the Javascript APIs are just a subset of AM, i.e. when you call a function it fires a bunch of AM code for you. Also I jumped to the Javascript wagon and the AM stuff is kinda scary