• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Export all layer as JPGs

Community Beginner ,
Jan 04, 2022 Jan 04, 2022

Copy link to clipboard

Copied

Hey Man. I am a Children Book Illustrator and I really really need your help...

Can you please guide me how can I Export all my Layers with their name as JPGs (maximum Quality and Size same as Artboard) in illustrator.

I have seen that you have Helped a lot of guys in the Form so I thought I should contact you.

I have already tired using MultiExporter Script But it does not export in Maximum Quality and it also does not export in Artboard Size.

I have also tired to use Actions. when I use the action for the first time it goes Good but next time it asks to replace the file since the file with same name already exist. is their a way to change the name of the file to the layer name somehow automatically when the action executes. 

TOPICS
Draw and design , Import and export , Scripting , Tools

Views

433

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advisor , Jan 05, 2022 Jan 05, 2022

@Zain22507017psdl,

 

Give this one a try...

 

var main = function() {

doc = app.activeDocument
myartboardName = doc.artboards[0].name.toString();

var myFolder = Folder.selectDialog ("Select a location to export the jpeg files.");
if (myFolder != null){ 
}else{
return;
}

 function hideLayers(mylayers) {
   for (var i = 0; i < mylayers.length; i++) {
      mylayers[i].visible = false;
   }
}

for(var a = 0; a < doc.layers.length; a++) {
   hideLayers(doc.layers);
   doc.layers[a].visible = true;
  
...

Votes

Translate

Translate
Adobe
Advisor ,
Jan 05, 2022 Jan 05, 2022

Copy link to clipboard

Copied

@Zain22507017psdl,

 

I'm guessing you have a single artboard with multiple layers..correct? if so give the below script a try....

var main = function() {

doc = app.activeDocument

var myFolder = Folder.selectDialog ("Select a location to export the jpeg files.");
if (myFolder != null){ 
}else{
return;
}

 function hideLayers(mylayers) {
   for (var i = 0; i < mylayers.length; i++) {
      mylayers[i].visible = false;
   }
}

for(var a = 0; a < doc.layers.length; a++) {
   hideLayers(doc.layers);
   doc.layers[a].visible = true;
   var myLayerName = doc.layers[a].name;

    var exportOptions = new ExportOptionsJPEG();   
    var exportName = (myFolder +"/"+ myLayerName + ".jpg");
    var dest = new File(exportName);
    var type = ExportType.JPEG;
    exportOptions.antiAliasing = true;
    exportOptions.qualitySetting = 100;
    exportOptions.horizontalScale = 100;
    exportOptions.verticalScale = 100;
    exportOptions.optimization = true;
    exportOptions.artBoardClipping = true;

    doc.exportFile(dest,type,exportOptions);
}

function showLayers(mylayers) {
   for(var i = 0; i < mylayers.length; i++) {
      mylayers[i].visible = true;
  }
}
showLayers(doc.layers);

alert("Done exporting layers to jpegs!")
} 
main();

 

Regards,

Mike

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 05, 2022 Jan 05, 2022

Copy link to clipboard

Copied

First of all thanks, man. Thank you so Much for Responding.

The Problem with this Script is that it changes the Dimensions of the image. For Example, if I choose the Export As option and select 300pi resolution with Quality: 10(maximum). I get an image with Dimensions = 2550x3300px (8.5x11inches is my artboard size) But when I export with this Script it Gives me the Dimensions = 612x792px.

Please help me with This one Man it's tedious to just export 40 layers at a time and when the client wants to change anything I have to just export them all again.

Although I'm thankful that you have replied.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jan 05, 2022 Jan 05, 2022

Copy link to clipboard

Copied

@Zain22507017psdl,

 

Give this one a try...

 

var main = function() {

doc = app.activeDocument
myartboardName = doc.artboards[0].name.toString();

var myFolder = Folder.selectDialog ("Select a location to export the jpeg files.");
if (myFolder != null){ 
}else{
return;
}

 function hideLayers(mylayers) {
   for (var i = 0; i < mylayers.length; i++) {
      mylayers[i].visible = false;
   }
}

for(var a = 0; a < doc.layers.length; a++) {
   hideLayers(doc.layers);
   doc.layers[a].visible = true;
   var myLayerName = doc.layers[a].name.toString();

   doc.artboards[0].name = myLayerName;  

   jpg = new File(myFolder + "/");

   var jpg_Export = new ExportForScreensItemToExport();
       jpg_Export.artboards = "all";
       jpg_Export.document = false;
   
   var jpg_Param = new ExportForScreensOptionsJPEG();
       jpg_Param.compressionMethod = JPEGCompressionMethodType.PROGRESSIVE;
       jpg_Param.progressiveScan = 5;
       jpg_Param.antiAliasing = AntiAliasingMethod.TYPEOPTIMIZED;
       jpg_Param.embedICCProfile = true;
       jpg_Param.scaleType = ExportForScreensScaleType.SCALEBYRESOLUTION;
       jpg_Param.scaleTypeValue = 300;
   
   doc.exportForScreens(jpg, ExportForScreensType.SE_JPEG100, jpg_Param, jpg_Export);
}

doc.artboards[0].name = myartboardName;

function showLayers(mylayers) {
   for(var i = 0; i < mylayers.length; i++) {
      mylayers[i].visible = true;
  }
}
showLayers(doc.layers);

alert("Done exporting layers to jpegs!")
} 
main();

 

Regards,

Mike

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 06, 2022 Jan 06, 2022

Copy link to clipboard

Copied

LATEST

IT Worked!!!

Thanks man. Thank you So much!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines