1 Reply Latest reply on Aug 8, 2012 1:41 PM by Larry G. Schneider

    Raster multiple layers in AI without flattening to 1 layer

    jameslloydnelson

      I am trying to turn every layer in my .ai file to a raster image without flattening to one layer. Im assuming a script would be best for this.

       

      -The big issue I am dealing with is the agency that just built a paralax site for us refuses to export to PSD. I have tried every possible way to do this but keep getting the file is to big message. To add to it they had it all on 1 layer. I was able to release to sequence, but now am trying to see if rasterizing the objects will help.

       

      Thanks so so much in advance we are in crisis mode.

        • 1. Re: Raster multiple layers in AI without flattening to 1 layer
          Larry G. Schneider Adobe Community Professional & MVP

          I have this in my collection of scripts which I modified to save .psd files

          #target illustrator
          
          /**
          * @author Niels Bosma (niels.bosma@motorola.com
          */
          
          var folder = Folder.selectDialog();
          var document = app.activeDocument;
          if(document && folder)
          {    
              var options = new ExportOptionsPhotoshop();
              options.antiAliasing = true;
              options.resolution = 300.0;
               options.warnings = false;
              
              var n = document.layers.length;
              for(var i=0; i<n; ++i)
              {
                  hideAllLayers();
                  var layer = document.layers[i];
                  layer.visible = true;
              
                  var file = new File(folder.fsName+"/"+layer.name+".png");
                  document.exportFile(file,ExportType.PNG24,options);    
              }
              
              showAllLayers();
          }
          
          function hideAllLayers()
          {
              forEach(document.layers, function(layer) {
                  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[i]);
              }
          }