I have two scripts I have been using for a while... one saves a incremenal jpg and the other saves a incrmental PNG... both "should" also retain the current pixle dimentison and DPI. (My old png script used to lower the dpi for some reason) PNG Script var saveFolder = new Folder( "D:\\Projects\\_IncSave" );
var saveExt = 'png';
var saveSufixStart = '_';
var saveSufixLength = 3;
// End of user options
var docName = decodeURI ( activeDocument.name );
docName = docName.match( /(.*)(\.[^\.]+)/ ) ? docName = docName.match( /(.*)(\.[^\.]+)/ ) : docName = [ docName, docName, undefined ];
var saveName = docName[ 1 ]; // activeDocument name with out ext
var files = saveFolder.getFiles( saveName + '*.' + saveExt );// get an array of files matching doc name prefix
var saveNumber = files.length + 1;
//alert("New file number: " + zeroPad( saveNumber, saveSufixLength ));
var saveFile = new File( saveFolder + '/' + saveName + '_' + zeroPad( saveNumber, saveSufixLength ) + '.' + saveExt );
saveAsPNG(saveFile, 9);
function zeroPad ( num, digit ) {
var tmp = num.toString();
while (tmp.length < digit) { tmp = "0" + tmp;}
return tmp;
}
function saveAsPNG(saveFile, quality) {
pngOpts = new PNGSaveOptions();
pngOpts.compression = quality; //0-9
pngOpts.interlaced = false;
activeDocument.saveAs(File(saveFile), pngOpts, true);
} JPG Script saveIncrementally();
function saveIncrementally() {
try {
var saveFolder = "D:\\Projects\\_IncSave";
if (!Folder(saveFolder).exists) {
saveFolder = Folder.selectDialog("Select output folder");
if (!saveFolder)
return;
}
var saveExt = 'jpg';
var saveSufixStart = '_';
var saveSufixLength = 3;
// End of user options
//==========================================
var docName = decodeURI ( activeDocument.name );
var dot = docName.lastIndexOf(".");
var saveName = docName.slice(0, dot);
var suffix = zeroPad(0, saveSufixLength);
var myFile = saveFolder + "/" + saveName + "_" + suffix + ".jpg";
while (File(myFile).exists) {
var suffixInteger = parseInt(suffix, 10);
suffixInteger += 1;
suffix = zeroPad(suffixInteger, 3);
myFile = saveFolder + "/" + saveName + "_" + suffix + ".jpg";
}
saveJPEG(myFile, 10)
function saveJPEG(saveFile, qty ) {
var saveOptions = new JPEGSaveOptions();
saveOptions.embedColorProfile = true;
saveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
saveOptions.matte = MatteType.NONE;
saveOptions.quality = qty;
app.activeDocument.saveAs( File(saveFile), saveOptions, true );
}
function zeroPad ( num, digit ){
var tmp = num.toString();
while (tmp.length < digit) { tmp = "0" + tmp;}
return tmp;
}
} catch(e) {
alert(e.toString() + "\nLine: " + e.line.toString())
}
} Can somone that knows how these things work (I copied these form a reddit post that is now locked) and make sure these sctips also save the current colour profile into the image, as if the tick box in the save dialouge is ticked?
... View more