Copy link to clipboard
Copied
I want the exported pictures to use the artboard's size. Thanks in advance.
var folder = Folder.selectDialog();
var document = app.activeDocument;
if(document && folder)
{
var options = new ExportOptionsJPEG();
options.antiAliasing = true;
options.qualitySetting = 100;
options.optimization = true;
options.croppingMaskClipping = true;
//scale to 500dpi
options.verticalScale = 500;
options.horizontalScale = 500;
var n = document.layers.length;
for(var i=0; i<n; ++i) {
hideAllLayers();
var layer = document.layers;
layer.visible = true;
var file = new File(folder.fsName+"/"+layer.name+".jpg");
document.exportFile(file,ExportType.JPEG,options);
}
//to show all layers visible when done:
showAllLayers();
}
function hideAllLayers()
{
forEach(document.layers, function(layer) {
/**
if there is one or more layers called 'ABC' in the .ai file, it will always be part of the export.
*/
if( layer.name != "ABC"){
layer.visible = false;
}
});
}
function showAllLayers()
{
forEach(document.layers, function(layer) {
layer.visible = true;
});
}
function forEach(collection, fn)
{
var n = collection.length;
for(var i=0; i<n; ++i)
{
fn(collection);
}
}
Hi there...
This isn't tested, but I believe that you should just need to add one line --
......
var options = new ExportOptionsJPEG();
options.antiAliasing = true;
options.qualitySetting = 100;
options.optimization = true;
options.croppingMaskClipping = true;
options.artBoardClipping = true;
//scale to 500dpi
options.verticalScale = 500;
options.horizontalScale = 500;
......
Hope this helps!
-TT
Copy link to clipboard
Copied
Hi there...
This isn't tested, but I believe that you should just need to add one line --
......
var options = new ExportOptionsJPEG();
options.antiAliasing = true;
options.qualitySetting = 100;
options.optimization = true;
options.croppingMaskClipping = true;
options.artBoardClipping = true;
//scale to 500dpi
options.verticalScale = 500;
options.horizontalScale = 500;
......
Hope this helps!
-TT
Copy link to clipboard
Copied
That helps, Thank a lot!
Copy link to clipboard
Copied
You're welcome. Nice avatar!