6 Replies Latest reply on Nov 17, 2010 9:02 AM by herr mueller

    InDesign export page item as PNG - DPI issues

    Peter Celuch Level 4

      Hey guys!

       

      I'm trying to create a script, that would go through all pageItems, make a snapshot and save them as PNGs. I managed to save page items in 100% resolution, but I need better resolution and I can't find any solution.

       

       // transparent PNG, resolution: 100%
       pageItem.exportFile(ExportFormat.PNG, file, false);
      
      

       

      Another unsuccessfull try was to scale-up the item and then scale it back down, but there were serious issues with text, flowing around imges ... anywas, It was just a desperate try, definitely not a solution

       

       // scale item up, take snapshot, then scale item down.
       // worked almost fine, problems arouse with texts flowing
       // around images - text zoomed, image area did not :)
       pageItem.horizontalScale *= zoom;
       pageItem.verticalScale *= zoom;
       pageItem.exportFile(ExportFormat.JPG, file, false);
       pageItem.horizontalScale /= zoom;
       pageItem.verticalScale /= zoom;
      
      

       

      I've been messing with PDFExportPresets, hoping that their colorBitmapSamplingDPI would be in some way used, but no luck

       

       // using pdf export preset ... sucks
       var preset:PDFExportPreset = InDesign.app.pdfExportPresets.firstItem();
       pageItem.exportFile(ExportFormat.PNG, file, false, preset);
      
      

       

      The only way I found to export a page item is JPEG with "showingOptions" set to "true", but that's far away from the desired effect (transparent PNG without user promting )

       

       // non-transparent JPEG, resolution: user defined, but displays annoying dialog box
       pageItem.exportFile(ExportFormat.JPG, file, true);
      
      

       

       

      any ideas?

      thx

        • 1. Re: InDesign export page item as PNG - DPI issues
          Bob Stucky Adobe Employee

          It's a bit convoluted but, export as EPS from InDesign, then open the EPS in Photoshop. If you open it in PS' UI, you'll get a dialog that allows you to set the dpi of the rasterizing process. You can do that via script using Script Listener code. I typically use 600 or 1200 dpi. Then just save as PNG.

           

          Regards

           

          Bob

          • 2. Re: InDesign export page item as PNG - DPI issues
            Peter Celuch Level 4

            wow bob! convoluted you say, huh?

             

            By "save as PNG" you mean the whole document / page? because I needed the particular parts of the page (pictures, articles) exported separately, not flattened. Thanks for the idea, but I'm affraid the multi-app script won't work for me - I need ID script only

             

            Isn't there a way to set up the "PageItem.exportFile()" to export in different DPI? Or maybe just for a moment change DPI of the whole document, export PNGs and change the document's DPI back. Won't that work? (I'm not sure where to change doc's DPI..)

            • 3. Re: InDesign export page item as PNG - DPI issues
              Olav Martin Kvern Level 3

              flashlabs.eu asked: "Isn't there a way to set up the "PageItem.exportFile()" to export in  different DPI? Or maybe just for a moment change DPI of the whole  document, export PNGs and change the document's DPI back. Won't that  work? (I'm not sure where to change doc's DPI..)"

               

              Changing the documents DPI won't work. I was thinking that we might be able to do this (ExtendScript version):

               

              app.xflExportPreferences.pageRange = PageRange.SELECTED_ITEMS;
              app.xflExportPreferences.rasterFormat = XFLRasterizeFormatOptions.PNG;
              app.xflExportPreferences.rasterResolution = 300;
              pageItem.exportFile(ExportFormat.packagedXFL, File("/c/test.zip"), false);

               

              ...and then open the resulting zip and extract the image (from the LIBRARY folder). But...no, that doesn't work--everything except images gets rasterized at 72 dpi. This is true even when exporting the objects from the UI--the PNG resolution setting only affects *placed images* in the InDesign file.

               

              JPEG export options, on the other hand, work just fine. Is there a way you could use JPEGs?

               

              Let's keep poking at this--I feel that there must be a way....

               

              Thanks,

               

              Ole

              • 4. Re: InDesign export page item as PNG - DPI issues
                Peter Celuch Level 4

                Thanks Olav, interesting approach but unfortunately I need hi-quality text as well, and all with transparency so PNG is the only way for me

                • 5. Re: InDesign export page item as PNG - DPI issues
                  Peter Celuch Level 4

                  How about scaling the whole document?

                  Is it possible? ID exports all page items in 100% scale (72dpi) so what if my font wasn't 12px but 24px and all objects were 2x bigger (still 72dpi)?

                   

                  As I mentioned in the beginning - temporary item scaling up and down works ok. Except items' interaction. If you scale items individually, their interactions are all messed up (picture in text etc.)

                   

                  But If you could scale it all as one piece and than export one by one ... I believe this could work just fine. The only problem is - I have no idea how to scale the whole document

                  • 6. Re: InDesign export page item as PNG - DPI issues
                    herr mueller Level 1

                    I solved this once by exporting each page to a pdf. Importing each page to a document 2x the dimensions and placing each page into a container and fitting to the container. Again, convoluted but workable.