25 Replies Latest reply: Jul 16, 2013 7:59 AM by Philipp Lehmann RSS

    Export to PNG in InDesign?

    Tricia Ho Community Member

      Hi all,

       

      I have a simple question. Is it possible to export to PNG in InDesign? Right now, I've been doing a copy-paste into Illustrator, then saving it as PNG from there. Is there a better way to do this?

       

      Trish

      InDesign CS4 | PC

        • 1. Re: Export to PNG in InDesign?
          Scott Falkner Community Member

          No version of InDesign can export to PNG. But there is a much better way than copy/paste into Illustrator. Export a PDF then save that as PNG from Acrobat or rasterize in Photoshop and save as PNG from Photoshop.

          • 2. Re: Export to PNG in InDesign?
            Community Member

            export the PDF and open and save in Photoshop.

            • 3. Re: Export to PNG in InDesign?
              [Jongware] MVP

              Oddly enough, that's not .. entirely .. true.

               

              The CS4 scripting help lists "PNG Format" amongst its possible export formats. A  quick test

               

              app.activeDocument.selection[0].exportFile(ExportFormat.PNG_FORMAT, File(new File("c:\\test.png")));
              

              shows CS4 can export to PNG. However, there are no settings to change, which limits its usefulness.

              • 4. Re: Export to PNG in InDesign?
                GJC0703 Community Member

                Hi Scott,

                 

                What version of PDF would you recomend exporting to?

                 

                Thanks,

                 

                George

                • 5. Re: Export to PNG in InDesign?
                  Scott Falkner Community Member

                  High Quality Print should be fine. You want transparency and RGB colours preserved.

                  • 6. Re: Export to PNG in InDesign?
                    SebastiaoV Community Member

                    Thanks for the good info. By the way Scott, how can i be sure to keep RGB features while exporting to PDF? I think the original logo is CMYK, should i choose change colour profile and change output (i don't know if those are the right words in English) but here is the dialog box in Spanish.

                     

                    Thanks for any input.

                     

                    Captura de pantalla 2011-02-01 a las 12.12.36.png

                     

                     

                    By the way, i did a "than copy/paste into Illustrator. Export a PDF then save that as PNG  from Acrobat Pro" but the PNG is 4 Kb and even placing a high setting the resolution is very low res. I might be doing something wrong.

                     

                    Captura de pantalla 2011-02-01 a las 12.28.03.png

                    • 7. Re: Export to PNG in InDesign?
                      rtherbfishing Community Member

                      Would you use this setting to use the .png for web use as well?

                      • 8. Re: Export to PNG in InDesign?
                        Djspaceg Community Member

                        Interesting. I'm actually very interested in PNG export from InDesign. It seems like that would be the ideal way for me to get what I need. I've explored as many other options as I can think of, all of which are sort of crummy. Here's what I've tried so far:

                         

                        My document is composed of 35 pages, which represent 7 zoom levels for the 5 floor maps of my building. The floor maps are made in Illustrator and "placed" into master-pages. Indesign handles all of the text overlays for the maps. It's better than Illustrator for this because of the ability to create paragraph and character styles that are global.

                         

                        1. From InDesign: Export to PDF -> Open each page one at a time in Illustrator -> Export to PNG. <-- Clumbsy and time consuming.
                        2. From InDesign: Export to EPS -> Open each file one at a time in Illustrator -> Export to PNG. <-- Time Consuming and doesn't preserve artboard/content position on page.
                        3. From InDesign: Export to PDF -> Open each page one at a time in Photoshop-> Export to PNG. <-- Takes minutes to open one page, and is too slow to consider, Photoshop tries to open every page that slowly, in sequence.
                        4. From InDesign: Export to EPS -> Open each page one at a time in Photoshop-> Export to PNG. <-- Rasterizes at too low of resolution to be useful and doesn't preserve artboard/content position on page.
                        5. From InDesign: Export to JPG -> Open each image in Photoshop -> Run batch process that magicwands the color-key -> delete the background to make translucent background -> Export to PNG. <-- Fast, but no subtile translucency is possible since we don't get a true alpha channel to work with.

                         

                        So that's the processes I've tried. Can anyone think of more I can try? The ulitmate goal is to have each page in InDesign export to a translucent backed image format, which I can then convert to PNG. TIFF, TGA, or PNG would all equally work. I just want to preserve the position of the content relative to the artboard/page AND preserve the translucency of the content.

                         

                        I used to export using JPG, but the translucency has become a priority since these images will be stacked on top of other images as tiles on Google Maps.

                         

                        Thanks for any advice or suggestions anyone can provide.

                        • 9. Re: Export to PNG in InDesign?
                          John Hawkinson Community Member

                          I feel like there may be some real problems with this workflow...does anyone know how InDesign compresses PNG files in exported PDFs?

                           

                          In any event, if you Export to PDF in InDesign, you can open it in Acrobat Professional, and then File > Save As > Image... > PNG and it will save one file for each page of your document.

                           

                          (If you have a complex question that's not the same as an old question, you're usually better off starting a new thread...)

                          • 10. Re: Export to PNG in InDesign?
                            Djspaceg Community Member

                            Thanks John. My post got longer than I originally expected. Otherwise I would have just made a new thread.

                             

                            I feel like I should clarify my original post that you replied to. That list of processes isn't one sequence of actions to get a final product. It lists every seperate method I've tried (unsuccessfully) to get usable images out of InDesign. I'm not doing them all in sequence. That would be a real workflow issue.

                             

                            Saving PDFs from Acrobat doesn't give you translucent PNGs, because of the white paper background it assumes; even if you didn't have a background set in InDesign. I tried that too and was disappointed. Also, there's no way to "delete" the paper/page/white-background in Acrobat Pro before saving as PNG.

                            • 11. Re: Export to PNG in InDesign?
                              rob day MVP
                              Also, there's no way to "delete" the paper/page/white-background in Acrobat Pro before saving as PNG.

                               

                               

                              When you export the PDF from ID make sure it includes live transparency (i.e., PDF/X-4 and not PDF/X-1a), then the document's page background will be transparent when you open it into Photoshop.

                               

                              Saving pages out to PNGs is scriptable—I have an AppleScript that would work if you’re using OSX. I'm not sure why a PDF page would take minutes to open unless you are asking for huge res—my script opens a page at 300 ppi in a few seconds.

                              • 12. Re: Export to PNG in InDesign?
                                Djspaceg Community Member

                                Oh that's perfect! That's exactly the type of advice I was hoping for! I never knew what the significant differences were between those PDF/X-x formats. I was able to export my InDesign document as a PDF and successfully open the translucent pages in Photoshop.

                                 

                                I actually only have CS5 for Windows here at work, (and a copy of CS3 on my personal Mac) but am a Programmer and am familiar with AppleScript, so If you'd be willing to share, I'd love to get ahold of your script. If it just can't work with Photoshop as old as CS3, I'm sure I can create a Windows equivilant.

                                 

                                There must have been something wrong when I tried importing the PDF earlier. This X-4 opened very quickly and came with a convenient resolution and page selection dialog.

                                 

                                Much appreciated! Thanks.

                                • 13. Re: Export to PNG in InDesign?
                                  rob day MVP

                                  This is for CS5, but probably works back to CS3. Shows a dialog for choosing resolution and anti aliasing,  asks for a destination folder, and writes the pdf and pngs to that  folder.

                                   

                                  http://www.zenodesign.com/forum/IDpagestoPNG.zip

                                  • 14. Re: Export to PNG in InDesign?
                                    RodneyA Community Member

                                    If you're using a workflow like version 3 (open each page one at a time in Photoshop...), that's like a workflow I use every other month. If you drag the entire multi-page PDF file onto your Photoshop icon, you can tell it to open all of the pages at x resolution in y color space, and then go get some coffee -- when you get back, they're all open, stacked in order with page 1 on top, and you can flatten and save them all as PNG files pretty quickly. And if you do it often, I'm sure you can create some kind of script to do it. Scripts wouldn't help in my case, so I haven't looked into it.

                                    • 15. Re: Export to PNG in InDesign?
                                      Peter Spier ACP/MVPs

                                      You could certinly create an action that could be used to batch convert the open files....

                                      • 16. Re: Export to PNG in InDesign?
                                        [Jongware] MVP

                                        Where's y'all imagination?

                                         

                                        This is a Quick-and-So-Very-Dirty-Dirty-Dirty javascript with lots of traps and pitfalls; still, it works as a Proof Of Concept to do the dirty thang straight out of InDesign.

                                        (In particular I cannot stress enough: Do Not Use On Your Live Document. Save a copy first, because this script messes up your document, and if good old trusty InDesign chooses to crash while running the script, this Messed Up Version will be saved as "current one"!!)

                                         

                                        //DESCRIPTION:Export all pages to PNGs -- Do Not Use For Production Purposes
                                        // A Move Along, Nothing to See Here Production
                                        for (pg=0; pg<app.activeDocument.pages.length; pg++)
                                        {
                                             page = app.activeDocument.pages[pg];
                                             for (mas=0; mas < page.appliedMaster.pageItems.length; mas++)
                                                  try {
                                                       page.appliedMaster.pageItems[mas].override(app.activeDocument.pages[pg]);
                                                  } catch (bah) { }
                                        
                                             g = page.groups.add(page.pageItems);
                                             g.exportFile(ExportFormat.PNG_FORMAT, File(Folder.myDocuments.fsName+"/"+(page.name)+".png"));
                                        }
                                         
                                        
                                        
                                        • 17. Re: Export to PNG in InDesign?
                                          rob day MVP
                                          This is a Quick-and-So-Very-Dirty-Dirty-Dirty javascript

                                           

                                          I haven't try your code but does JavaScript give you access to a PNG export format that isn't available with the UI? I'm not seeing it in the AppleScript dictionary.

                                          • 18. Re: Export to PNG in InDesign?
                                            John Hawkinson Community Member

                                            Rob, you know your identity has converted to doppelgangerland?  See Why has my account spawned a similar identity?

                                             

                                            Anyhow, yes, Javascript does. Note that the applescript dictionary doesn't appear to actually have the types enumerated, there's just a text string about them (that also gets offered as an error). So you can do this:

                                             

                                            tell application "Adobe InDesign CS5" to export first group of active document format "PNG" to "path:to:mine.png"

                                             

                                            and it works fine.

                                            • 19. Re: Export to PNG in InDesign?
                                              rob day MVP

                                              Cool—too bad it only works for page items and not pages.

                                               

                                              Rob, you know your identity has converted to doppelgangerland?

                                               

                                              Had that happen a few months ago and thought I had fixed it—can't see it happening from inside my account.

                                              • 20. Re: Export to PNG in InDesign?
                                                John Hawkinson Community Member

                                                Doppelganger is now gone. Go figure.

                                                • 21. Re: Export to PNG in InDesign?
                                                  emphor Community Member

                                                  I couldn't get the script to work on CS4.

                                                   

                                                  I dropped it into the applescript folder in Scripts > Scripts Panel > Samples > AppleScript.

                                                   

                                                  Here's a screen shot of the export options:

                                                  Picture 1.png

                                                  Would love to export to PNG, but the Acrobat workaround might have to do the job for now.

                                                  • 22. Re: Export to PNG in InDesign?
                                                    Stix Hart Community Member

                                                    After you've dumped it in there you go to the scripts panel to run it.  You'll find it under Samples, I prefer to open the scripts panel first, right click where I want to put it and choose Reveal in...  That opens up a window to paste it into.

                                                    • 23. Re: Export to PNG in InDesign?
                                                      emphor Community Member

                                                      Cheers Stix. Must admit, I've never noticed the scripts panel before, worked a treat.

                                                      • 24. Re: Export to PNG in InDesign?
                                                        Stix Hart Community Member

                                                        If you've never noticed it before you're in for a treat, there's heaps of cool scripts installed by default and many more heaps cooler ones available for free!  This one here for example is my favourite.  Look here for some more but that's quite an old list.

                                                        • 25. Re: Export to PNG in InDesign?
                                                          Philipp Lehmann Community Member

                                                          Heres a solution for exporting pages (cropped or the whole page) or a selection.
                                                          Beware the script saves the file first and reverts to the saved version when done.

                                                           

                                                           

                                                          #target InDesign
                                                          //DESCRIPTION: Export PNG
                                                          /* 
                                                                    Author: Philipp Lehmann
                                                                    Datum: 2013-07-17
                                                          */
                                                          
                                                          
                                                          var column_left = 150;
                                                          var column_center_big = 140;
                                                          var column_center_small = 60;
                                                          var column_right = 210;
                                                          var column_right_text = 200;
                                                          var myDoc;
                                                          var myAssetName;
                                                          
                                                          
                                                          
                                                          
                                                          if (app.documents.length > 0) {
                                                                    var userLevel = app.scriptPreferences.userInteractionLevel;
                                                                    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
                                                                    var _version = app.scriptPreferences.version;
                                                                    var myDoc = app.activeDocument;
                                                                    /*var hMUnits = myDoc.viewPreferences.horizontalMeasurementUnits;
                                                                    myDoc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.MILLIMETERS;
                                                                    var VMUnits = myDoc.viewPreferences.verticalMeasurementUnits;
                                                                    myDoc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.MILLIMETERS;
                                                                    var rulerOrigin = myDoc.viewPreferences.rulerOrigin;
                                                                    myDoc.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN
                                                                    var zeroPoint = myDoc.zeroPoint; 
                                                                    myDoc.zeroPoint = [0,0]
                                                                    var tRPoint = myDoc.layoutWindows[0].transformReferencePoint;
                                                                    myDoc.layoutWindows[0].transformReferencePoint = AnchorPoint.TOP_LEFT_ANCHOR;*/
                                                          
                                                                    try {
                                                                              main ();
                                                                    } catch (e) {
                                                                              alert("An error occured at:\n" + e +
                                                                                                  "\nLine: " + e.line +
                                                                                                  "\nScript: " + e.fileName );
                                                                    }
                                                          
                                                          
                                                                    app.scriptPreferences.userInteractionLevel = userLevel;
                                                                     /*app.scriptPreferences.version = _version
                                                                    myDoc.viewPreferences.horizontalMeasurementUnits = hMUnits;
                                                                    myDoc.viewPreferences.verticalMeasurementUnits = VMUnits;
                                                                    myDoc.viewPreferences.rulerOrigin = rulerOrigin;
                                                                    myDoc.zeroPoint = zeroPoint; 
                                                                    myDoc.layoutWindows[0].transformReferencePoint = tRPoint;*/
                                                          } else {
                                                                    alert ("No document");
                                                          }
                                                          
                                                          
                                                          function main(){
                                                              // Save document and open the dialog
                                                              myDoc.save();
                                                          
                                                          
                                                                    //Make certain that user interaction (display of dialogs, etc.) is turned on.
                                                                    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
                                                              myAssetName = (myDoc.name.replace(".indd"," "));
                                                                    myExportDialog();
                                                          }
                                                          
                                                          
                                                          function myExportDialog(){
                                                                    with(myDialog = app.dialogs.add({name:"Export PNG"})){
                                                          
                                                                              //Add dialog labels in three columns
                                                                              myDialogColumn = dialogColumns.add() 
                                                                  /*with(myDialogColumn){
                                                                                        with(borderPanels.add()){
                                                                                                  staticTexts.add({staticLabel:"Transparent Images:", minWidth: column_left});
                                                                                                  with(myExportFormatButtons = radiobuttonGroups.add()){
                                                                                                            radiobuttonControls.add({staticLabel:"Yes", checkedState:true, minWidth: column_right});
                                                                                                            radiobuttonControls.add({staticLabel:"No", minWidth: column_right});
                                                                                                  }
                                                                           with (myPageSelection = dialogColumns.add() ) {
                                                                           }
                                                                                        }
                                                                              }*/
                                                                              with(myDialogColumn){
                                                                                        with(borderPanels.add()){
                                                                                staticTexts.add({staticLabel:"Crop Image:", minWidth: column_left});
                                                          
                                                          
                                                                          with(myCropButtons = radiobuttonGroups.add()){
                                                                                                            radiobuttonControls.add({staticLabel:"No", checkedState:true, minWidth: column_right});
                                                                                                            radiobuttonControls.add({staticLabel:"Yes", minWidth: column_right});
                                                                          }
                                                                          with (myPageSelection = dialogColumns.add() ) {
                                                                          }
                                                                                        }
                                                                              }
                                                                  with(myDialogColumn){
                                                                      with(borderPanels.add()){
                                                                          with (dialogColumns.add() ) {
                                                                              staticTexts.add({staticLabel:"Export area", minWidth: column_left});
                                                                          }
                                                                          with (dialogColumns.add() ) {
                                                                              with(myPageOptionButtons = radiobuttonGroups.add()){
                                                                                  radiobuttonControls.add({staticLabel:"Custom Pages", minWidth: column_center_big});
                                                                                  radiobuttonControls.add({staticLabel:"All Pages", checkedState:true, minWidth: column_center_big});
                                                                                  radiobuttonControls.add({staticLabel:"Export Selection", minWidth: column_center_big});
                                                                              }
                                                          
                                                          
                                                                              with (myPageSetting = dialogColumns.add() ) {
                                                                                  var myPageSelectionTextfield = textEditboxes.add({editContents: "", minWidth: column_center_small});
                                                                              }
                                                                          }
                                                          
                                                          
                                                                      }
                                                                              }
                                                                  with(myDialogColumn){
                                                                      with(borderPanels.add()){
                                                                          with (dialogColumns.add() ) {
                                                                              staticTexts.add({staticLabel:"Filename / Prefix", minWidth: column_left});
                                                                          }
                                                                          with (dialogColumns.add() ) {
                                                                              with (myFileSetting = dialogColumns.add() ) {
                                                                                  var myFilenameTextfield = textEditboxes.add({editContents: myAssetName, minWidth: column_right_text});
                                                                              }
                                                                          }
                                                          
                                                          
                                                                      }
                                                                              }
                                                          
                                                                              myReturn = myDialog.show();
                                                          
                                                                              if (myReturn == true){
                                                          
                                                                                        //Get the values from the dialog box.
                                                                                        //myExportFormat = myExportFormatButtons.selectedButton;
                                                                                        myCropOptions = myCropButtons.selectedButton;
                                                                                        myPageOptions = myPageOptionButtons.selectedButton;
                                                                       myPageSelection = myPageSelectionTextfield.editContents;
                                                                       myFilename = myFilenameTextfield.editContents;
                                                          
                                                                                        myFolder = Folder.selectDialog ("Choose Destination Folder");
                                                          
                                                                                        if(myFolder != null){
                                                                          applyOptions();
                                                                                        }
                                                                              } else{
                                                                                        myDialog.destroy();
                                                                              }
                                                                    }
                                                          }
                                                          
                                                          
                                                          // Call Export function for the corresponding pages.
                                                          function applyOptions() {
                                                              var myFile = new File(myFolder);
                                                          
                                                          
                                                              switch(myPageOptions) {
                                                                  case 0: 
                                                                      // Export single Pages for comma separated values.  
                                                                      if ( myPageSelection.match(',') == "," ) {
                                                                          var mp = myPageSelection.split(",");
                                                          
                                                                          for (i=0; i < mp.length; i++) {
                                                                              if ( parseInt(mp[i]) <= app.activeDocument.pages.length) {
                                                                                  exportPage(parseInt(mp[i]) - 1);
                                                                              } else {
                                                                                  alert("Invalid page selection");
                                                                              }
                                                                          }
                                                                          success();
                                                          
                                                                      } else {      
                                                                          if ( parseInt(myPageSelection) <= app.activeDocument.pages.length) {
                                                                              exportPage(myPageSelection - 1);
                                                                              success();
                                                                          } else {
                                                                              alert("Invalid page selection");
                                                                          }
                                                          
                                                                      }
                                                                      break;
                                                          
                                                                  case 1: 
                                                                      // Export all Pages
                                                                      for (i=0; i<app.activeDocument.pages.length; i++) {
                                                                          exportPage(i);
                                                                      }
                                                                      success();
                                                                      break;
                                                          
                                                                  case 2:
                                                                      // Export selection
                                                                      exportSelection();
                                                                      success();
                                                                      break;
                                                          
                                                                  default:
                                                                      alert("How did you do that");
                                                          
                                                              }
                                                          }
                                                          
                                                          
                                                          // Apply crop and transparency options and save the PNG-Files
                                                          function exportPage(pg) {
                                                              page = app.activeDocument.pages[pg];
                                                          
                                                              for (mas=0; mas < page.appliedMaster.pageItems.length; mas++)
                                                                    try {
                                                                         page.appliedMaster.pageItems[mas].override(app.activeDocument.pages[pg]);
                                                                    } catch (bah) { }
                                                          
                                                          
                                                              if(myCropOptions == 1) {
                                                                  var myDoc = app.activeDocument;
                                                          
                                                          
                                                                  var bounds = new Array();
                                                                  bounds[0] = 0;
                                                                  bounds[1] = 0;
                                                                  bounds[2] = myDoc.documentPreferences.pageHeight;
                                                                  bounds[3] = myDoc.documentPreferences.pageWidth;
                                                                  // Rectangle fit to Page
                                                                  r = page.rectangles.add({geometricBounds: bounds, strokeWeight: 0, fillColor: "None"});
                                                              }
                                                          
                                                          
                                                          
                                                              g = page.groups.add(page.pageItems);
                                                              // app.hostObjectDelegate.pngExportPreferences.transparentBackground = true;
                                                              g.exportFile(ExportFormat.PNG_FORMAT, File(myFolder+"/"+myFilename+(page.name)+".png"));
                                                          
                                                          
                                                              g.ungroup();
                                                          
                                                              if(myCropOptions == 1) {
                                                                  r.remove();
                                                              }
                                                          }
                                                          
                                                          
                                                          function exportSelection() {
                                                          
                                                              if (app.selection.length == 1) {
                                                                  g = app.selection[0];
                                                                  g.exportFile(ExportFormat.PNG_FORMAT, File(myFolder+"/"+myFilename+".png"));
                                                          
                                                                  success();
                                                          
                                                              } else if (app.selection.length > 1) {
                                                                  var myObj = new Array;
                                                                  myObj = app.selection;
                                                                  g = app.activeWindow.activePage.groups.add(myObj);
                                                                  g.exportFile(ExportFormat.PNG_FORMAT, File(myFolder+"/"+myFilename+".png"));
                                                                  g.ungroup();
                                                                  success();
                                                          
                                                              } else {
                                                                  alert("Please select at least one object");
                                                              }
                                                          }
                                                          
                                                          
                                                          function success() {
                                                              app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;
                                                              try{
                                                                   myDoc.revert();
                                                              } catch(error) {}
                                                              app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
                                                          }