5 Replies Latest reply on Nov 25, 2015 5:39 AM by williamadowling

    Raster to vector

    vkandakur

      Is it possible to detect text from tiff image (raster image) and create the same text in vector in adobe illustrator automatically?

       

      bunn-ultra-2-slush-machine-illustrated-parts-catalogue-14-638.jpg

        • 1. Re: Raster to vector
          williamadowling Level 4

          Depending on your needs, there's always Live Trace.

           

          Or are you asking if you can batch files with a script in order to automatically trigger a live trace?

          • 2. Re: Raster to vector
            vkandakur Level 1

            Exactly! I need a script to automatically trigger a live trace so that I can batch files. I have lakhs of files so live tracing manually would consume lot of time.

            • 3. Re: Raster to vector
              williamadowling Level 4

              Ok. I'll show you how to do it.. but i have to strongly recommend against this. Illustrator's live trace feature is really really ... not... good. In my experience, every image i live trace requires much tinkering with the settings to get it to look half-way decent, and even then, it's never perfect (or even close). I imagine you will end up with a lot of problems if you simply batch a folder with generic live trace settings..

               

              That said. here we go. This is untested, but as far as i know the logic is sound.

               

              Let me know how it goes.

               

              function traceRaster(){
                var docRef = app.activeDocument;
                for(var a=0;a<docRef.placedItems.length;a++){ //this script implies the images are LINKED, not embedded. if you are working with embedded images, change 'placedItems' to 'rasterItems'
                     var item = docRef.placedItems[a];
                     var traced = item.trace();
                     traced.tracing.tracingOptions.loadFromPreset('Line Art'); //Change 'Line Art' to your preferred tracing preset if necessary
                }
                docRef.close(SaveOptions.SAVECHANGES);
              }
              
              
              function batch(){
                var batchFolder = new Folder("/path/to/batch/folder"); //enter the path to the folder containing the files you want to batch.
                var theFiles = batchFolder.getFiles();
                for(var q=0;q<theFiles.length;q++){
                     open(files[q]);
                     traceRaster();
                }
              }
              batch();
              
              • 4. Re: Raster to vector
                vkandakur Level 1

                Thank You!

                • 5. Re: Raster to vector
                  williamadowling Level 4

                  No problem. let me know if it works for you, or if you have any other questions.