3 Replies Latest reply on Nov 1, 2012 11:41 PM by vinoth_mannu

    Need help to update script?

    vinoth_mannu Level 1

      Hi All,

       

      I have found a script which tells the resolution of the raster image in illustrator, but this run only for single image.

       

      I need this to be updated to N numbers of times of raster images.

       

      The information comes as alert in the current script, and i need the information to be placed as script log.

       

      #target illustrator

       

      var docRef = app.activeDocument;

       

      // We are expecting at least 1 raster item

       

      alert('Image: '+objectResolution(docRef.rasterItems[0])+' dpi');

       

       

      function objectResolution(obj) {

           if (obj.typename == 'PlacedItem' || 'RasterItem') {

                var objTrace = obj.trace();

                app.redraw();

                objTrace.tracing.tracingOptions.resample = false;         

                var objRes = Math.round(objTrace.tracing.imageResolution);

                objTrace.tracing.releaseTracing();

                app.redraw();    

                return objRes;

           } else {

                alert('This is the wrong type of object?');

                return false;

           }

      }

       

      Regards,

      Vinoth

        • 1. Re: Need help to update script?
          CarlosCanto Adobe Community Professional & MVP

          here you go

           

          #target illustrator
          
          var docRef = app.activeDocument;
          
          // We are expecting at least 1 raster item
          var sel = docRef.selection;
          for (i=0; i<sel.length; i++)
              alert('Image: '+objectResolution(sel[i])+' dpi');
          
          function objectResolution(obj) {
               if (obj.typename == 'PlacedItem' || obj.typename == 'RasterItem') {
                    var objTrace = obj.trace();
                    app.redraw();
                    objTrace.tracing.tracingOptions.resample = false;         
                    var objRes = Math.round(objTrace.tracing.imageResolution);
                    objTrace.tracing.releaseTracing();
                    app.redraw();    
                    return objRes;
               } else {
                    alert('This is the wrong type of object?');
                    return false;
               }
          }
          
          • 2. Re: Need help to update script?
            vinoth_mannu Level 1

            Thanks carlos,

             

            This works fine, I need further updates, I have multiple numbers of raster images in the files with this script i have to hit ok the get the result of raster image resolution.

             

            Could you please update this script if the raster images have less than 72 dpi an error message and the raster image information to be updated in script log file.

             

            Thanks in advance

            Vinoth

            • 3. Re: Need help to update script?
              vinoth_mannu Level 1

              Hi Carlos,

               

              A gentle remider about the above request.

               

              Thanks in advance

              Vinoth