Scripting a Save As animated GIF with "loop forever" and name, as a layer name

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: xbytor, DavideBarranca, Paul MR

Posts: 1
Joined: Tue Jul 18, 2017 6:29 pm

Scripting a Save As animated GIF with "loop forever" and name, as a layer name

Postby Cyril0001 » Tue Jul 18, 2017 6:31 pm

I have the script blow that saves JPG using a layer name. It works great.

I am trying to update this script so, that it would save animated GIF with "loop forever" option.

It would be just awesome if there is a possibility to set in the script quantity of GIF's colors (64, 128, 256), Transparency, Dithering and other parameters.

Any help would be very greatly appreciated!

#target photoshop
function main(){
if(!documents.length) return;
var Path= activeDocument.path;
}catch(e){var Path = "~/desktop";}
var Name = decodeURI(\.[^\.]+$/, '');
var layerName =[:\/\\*\?\"\<\>\|]/g, "_");
var saveFile= new File(Path + "/" + Name + "-" + layerName + ".jpg");
function SaveForWeb(saveFile,jpegQuality) {
var sfwOptions = new ExportOptionsSaveForWeb();
sfwOptions.format = SaveDocumentType.JPEG;
sfwOptions.includeProfile = false;
sfwOptions.interlaced = 0;
sfwOptions.optimized = true;
sfwOptions.quality = jpegQuality;
activeDocument.exportDocument(saveFile, ExportType.SAVEFORWEB, sfwOptions);

Return to “Help Me”

Who is online

Users browsing this forum: No registered users and 3 guests