Skip navigation
Currently Being Moderated

Export to PNG in InDesign?

Aug 16, 2009 6:23 PM

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

 
Replies
  • Currently Being Moderated
    Aug 16, 2009 7:12 PM   in reply to Tricia Ho

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 16, 2009 7:13 PM   in reply to Tricia Ho

    export the PDF and open and save in Photoshop.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 17, 2009 1:45 AM   in reply to Scott Falkner

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2010 10:39 AM   in reply to Scott Falkner

    Hi Scott,

     

    What version of PDF would you recomend exporting to?

     

    Thanks,

     

    George

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2010 10:16 PM   in reply to GJC0703

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

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 1, 2011 3:28 AM   in reply to Scott Falkner

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 1, 2011 11:52 AM   in reply to Scott Falkner

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

     
    |
    Mark as:
  • Currently Being Moderated
    May 20, 2011 1:00 PM   in reply to [Jongware]

    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.

     
    |
    Mark as:
  • John Hawkinson
    5,572 posts
    Jun 25, 2009
    Currently Being Moderated
    May 20, 2011 1:53 PM   in reply to Blake Stephens

    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...)

     
    |
    Mark as:
  • Currently Being Moderated
    May 23, 2011 6:11 AM   in reply to John Hawkinson

    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.

     
    |
    Mark as:
  • Rob Day
    3,123 posts
    Oct 16, 2007
    Currently Being Moderated
    May 23, 2011 9:04 AM   in reply to Blake Stephens
    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.

     
    |
    Mark as:
  • Currently Being Moderated
    May 23, 2011 10:20 AM   in reply to Rob Day

    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.

     
    |
    Mark as:
  • Rob Day
    3,123 posts
    Oct 16, 2007
    Currently Being Moderated
    May 23, 2011 12:56 PM   in reply to Blake Stephens

    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

     
    |
    Mark as:
  • Currently Being Moderated
    May 24, 2011 8:54 AM   in reply to Blake Stephens

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    May 24, 2011 12:59 PM   in reply to RodneyA

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

     
    |
    Mark as:
  • Currently Being Moderated
    May 24, 2011 2:50 PM   in reply to Peter Spier

    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"));
    }
     
     
    
     
    |
    Mark as:
  • Rob Day
    3,123 posts
    Oct 16, 2007
    Currently Being Moderated
    May 24, 2011 4:16 PM   in reply to [Jongware]
    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.

     
    |
    Mark as:
  • John Hawkinson
    5,572 posts
    Jun 25, 2009
    Currently Being Moderated
    May 25, 2011 5:37 PM   in reply to Rob Day

    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.

     
    |
    Mark as:
  • Rob Day
    3,123 posts
    Oct 16, 2007
    Currently Being Moderated
    May 26, 2011 5:56 AM   in reply to John Hawkinson

    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.

     
    |
    Mark as:
  • John Hawkinson
    5,572 posts
    Jun 25, 2009
    Currently Being Moderated
    May 26, 2011 6:00 AM   in reply to Rob Day

    Doppelganger is now gone. Go figure.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 12, 2011 8:06 PM   in reply to Rob Day

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 12, 2011 8:41 PM   in reply to emphor

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 12, 2011 9:25 PM   in reply to Stix Hart

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

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 12, 2011 10:41 PM   in reply to emphor

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 16, 2013 7:59 AM   in reply to Stix Hart

    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;
    }
     
    
     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (1)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points