6 Replies Latest reply on Feb 23, 2015 12:13 AM by Laubender

    [basil.js] Fast way for placing images

    doekewartena Level 1

      I need to place around 3500 pdf files.

      The size of the files varies from 1mb to around 80mb.


      At the moment it takes really long. It worked for around 4 hours now and it's like 60% done.

      I'm not sure why it takes so long. I think Indesign does a lot of processing after pleasing each image but i'm not sure.

      Here is the code that is used for placing the image:

      basil.js/image.js at master · basiljs/basil.js · GitHub


      I also wondered, indesign converts the image to a TIFF, does this mean that loading a TIFF is also the fastest?

      And if so, does the TIFF require certain settings?


      Hope someone can help.

        • 1. Re: [basil.js] Fast way for placing images
          Loic.Aigon Adobe Community Professional



          There are dozens of reasons why you could have performance leaks here. First of all, if you retrieve the 3500 pictures in a large array (getFiles maybe), it can takes time to go through the array depth. Second of all, the Basil code seems to do many operations (fitting, transforming…), its' not just about placing the image. All these actions multiplied by 3500 (plus I guess opening/closing/saving), that does a lot.


          So what solutions are left ? First, try with smaller files set. Second of all, maybe ensure that variables are actually nullyfied and that you are using as little as possible global variables. Third of all, consider working with idml. Last of all, if the file placement is basic (no graphic effects), you may try to do that injection outside InDesign (i.e. PDF) thanks to PDF utilities or a PDF-VT tool.


          Also, you may try to quit/restart InDesign every 50 processed documents (app.quit();) but I am not sure about the side effetcs of this one.






          • 2. Re: [basil.js] Fast way for placing images
            Laubender Adobe Community Professional & MVP

            @Loic – yes, that all. Plus do the drawing, the rendering of the placed images after placing all.
            There are some general view settings, you can manipulate, like showing no pixels, but a gray box with all placed images.


            Look into the object LayoutWindow where you can find a bunch of properties you can set:


            app.documents[0].layoutWindows[0].overprintPreview = false;
            app.documents[0].layoutWindows[0].viewDisplaySetting = ViewDisplaySettings.OPTIMIZED;


            And: In advance make sure that ViewDisplaySettings.OPTIMIZED is defined in a way, that no image preview is rendered to the page. Just a gray box indicating an image is there.

            That will speed up placing images dramatically.


            Oh, just another one: Turn off Preflight!



            • 3. Re: [basil.js] Fast way for placing images
              doekewartena Level 1

              Both thanks.

              I will try next week. I'm processing the pdf to tiff files now cause I have 13gig of vector data

              After that I can also pre size the tiff's to a format closer to the placing target format.

              • 4. Re: [basil.js] Fast way for placing images
                Trevorׅ Adobe Community Professional



                One thing to add on Loic's comments.

                Create the documents with no layout window by using setting the open or new document property to false.

                app.open(File("/c/blah.indd"), false);

                This can make a big difference, it is an alternative approach to Uwe's



                • 5. Re: [basil.js] Fast way for placing images
                  Loic.Aigon Adobe Community Professional



                  One another one may be used =


                  app.scriptPreferences.enableRedraw = false;


                  But to rebounce of what seems to be the source of the need :

                  …pdf to tiff files now cause I have 13gig of vector data


                  Are you sure it makes sense to choose raster other vector ? What are these PDF made of that you may want to flatten them ? And if it's just about flattening PDF to raster, I would definitively choose another approach. Have you noticed that next version of PitStop Server (13) will embed a PDF to Image functionnality ? It's likely that you get more performance there. You can also try with command line tools, search g…gle for command line PDF to Tiff utilities maybe ?






                  • 6. Re: [basil.js] Fast way for placing images
                    Laubender Adobe Community Professional & MVP

                    Since this question is related to the other thread about the options of saving TIFF files in PhotoShop, I double my answer from 

                    Best TIFF properties for InDesign

                    here again:


                    See also the following thread in this forum:

                    Re: Create image thumbnail later

                    mmmathur | Dec 16, 2014 4:41 PM


                    Here I quote OP (original poster): "It helped me reducing INDD file generation time by half."