|
|
@ -29,12 +29,12 @@ var site_names = csv_data.toString().split(",")
|
|
|
|
// Retrieve images parent directory from CoastSnap_Sites.csv
|
|
|
|
// Retrieve images parent directory from CoastSnap_Sites.csv
|
|
|
|
var parent_folder_path = File(site_names[9]);
|
|
|
|
var parent_folder_path = File(site_names[9]);
|
|
|
|
|
|
|
|
|
|
|
|
var batch_images_to_register = []; // Used in exportLayersToPNG
|
|
|
|
var batch_images_to_register = []; // Used in exportLayersToJPEG
|
|
|
|
|
|
|
|
|
|
|
|
// Loop through sites
|
|
|
|
// Loop through sites
|
|
|
|
for(var i=5; i<site_names.length; i+=5) {
|
|
|
|
for(var i=5; i<site_names.length; i+=5) {
|
|
|
|
var site_name = site_names[i];
|
|
|
|
var site_name = site_names[i];
|
|
|
|
var site_path = parent_folder_path + "/" + site_name;
|
|
|
|
var site_path = parent_folder_path + "/Images/" + site_name;
|
|
|
|
|
|
|
|
|
|
|
|
// Retrieve target and seed images for the site
|
|
|
|
// Retrieve target and seed images for the site
|
|
|
|
var target_folder = new Folder(site_path + '/Target Image');
|
|
|
|
var target_folder = new Folder(site_path + '/Target Image');
|
|
|
@ -97,7 +97,7 @@ function batch_register_images(batchIndex, site_path, site_name, images_to_regis
|
|
|
|
var target_height = target_size[1];
|
|
|
|
var target_height = target_size[1];
|
|
|
|
|
|
|
|
|
|
|
|
savePhotoshopDocument(site_path, site_name);
|
|
|
|
savePhotoshopDocument(site_path, site_name);
|
|
|
|
exportLayersToPNG(target_width, target_height, batch_images_to_register, seed_images); // Won't overwrite images that already exist
|
|
|
|
exportLayersToJPEG(target_width, target_height, batch_images_to_register, seed_images); // Won't overwrite images that already exist
|
|
|
|
|
|
|
|
|
|
|
|
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES)
|
|
|
|
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -233,7 +233,7 @@ function savePhotoshopDocument(site_path, site_name) {
|
|
|
|
// EXPORT LAYERS TO IMAGES
|
|
|
|
// EXPORT LAYERS TO IMAGES
|
|
|
|
|
|
|
|
|
|
|
|
// $.evalFile(File(app.path + '/Presets/Scripts/Export Layers To Files.jsx'));
|
|
|
|
// $.evalFile(File(app.path + '/Presets/Scripts/Export Layers To Files.jsx'));
|
|
|
|
function exportLayersToPNG(target_width, target_height, batch_images_to_register, seed_images){
|
|
|
|
function exportLayersToJPEG(target_width, target_height, batch_images_to_register, seed_images){
|
|
|
|
if(!documents.length) return;
|
|
|
|
if(!documents.length) return;
|
|
|
|
var doc = activeDocument;
|
|
|
|
var doc = activeDocument;
|
|
|
|
var oldPath = activeDocument.path;
|
|
|
|
var oldPath = activeDocument.path;
|
|
|
@ -317,7 +317,7 @@ function exportLayersToPNG(target_width, target_height, batch_images_to_register
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//activeDocument.trim(TrimType.TRANSPARENT,true,true,true,true);
|
|
|
|
//activeDocument.trim(TrimType.TRANSPARENT,true,true,true,true);
|
|
|
|
var saveFile = File(path +"/Photoshop/"+year+"/"+lname);
|
|
|
|
var saveFile = File(path +"/Photoshop/"+year+"/"+lname);
|
|
|
|
SavePNG(saveFile);
|
|
|
|
SaveJPEG(saveFile);
|
|
|
|
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
|
|
|
|
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -334,7 +334,7 @@ function dupLayers() {
|
|
|
|
executeAction( charIDToTypeID('Mk '), desc143, DialogModes.NO );
|
|
|
|
executeAction( charIDToTypeID('Mk '), desc143, DialogModes.NO );
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
function SavePNG(saveFile){
|
|
|
|
function SaveJPEG(saveFile){
|
|
|
|
var pngOpts = new ExportOptionsSaveForWeb;
|
|
|
|
var pngOpts = new ExportOptionsSaveForWeb;
|
|
|
|
pngOpts.format = SaveDocumentType.JPEG;
|
|
|
|
pngOpts.format = SaveDocumentType.JPEG;
|
|
|
|
pngOpts.PNG8 = false;
|
|
|
|
pngOpts.PNG8 = false;
|
|
|
|