12 Replies Latest reply on Dec 28, 2011 7:31 AM by Laubender

    Export objects as PNG file

    Felipe - dualpixel Level 3

      Hi, Anyone knows about a script or plug-in that let us export object as PNG file?

      Not a page just select object

       

      Thanks

        • 1. Re: Export objects as PNG file
          MW Design Level 4

          Until someone who knows if there is a plug-in or script, one can select the object, right-click and select Edit | Edit With... and select the appropriate application that is installed for the placed file. Other than copy and paste out of ID, I don't know how to do anything to objects created within ID.

           

          Other than PDF the page and edit that within PS.

           

          Mike

          • 2. Re: Export objects as PNG file
            Felipe - dualpixel Level 3

            Thanks,

             

            But I thinking about the issue, I believe that solve using the Export Object EPUB/HTML. Because I need set text frame as image, then I can setup this element as a PNG file to export as HTML.

            It's a way to do...

            • 3. Re: Export objects as PNG file
              BobLevine MVP & Adobe Community Professional

              There is no way I know of to do this and I doubt there's a script since scripts can only automate what the application itself is capable of.

               

              As already mentioned, export as PDF and open that in Photoshop.

               

              Bob

              • 4. Re: Export objects as PNG file
                John Hawkinson Level 5

                Strangely this is one of those rare examples where this is not true. The scripting API supports exporting to PNG.

                See: Aug 17, 2009 4:45 AM  Re: Export to PNG in InDesign?

                 

                I thought someone had a more canned script to do it but I can't seem to find it.

                • 5. Re: Export objects as PNG file
                  BobLevine MVP & Adobe Community Professional

                  I know there are some commands that a script can get to but I didn’t know about this one.

                   

                   

                   

                  Interesting. I wonder if that’s there for the epub export?

                   

                   

                   

                  Bob

                  • 6. Re: Export objects as PNG file
                    mckayk_777 Level 2

                    Not sure if this is whats needed but here goes:

                     

                    When making artwork to embed into Word I export from indesign via pdf open that pdf into illustrator and in there you have the option to export for "Save for Microsoft Office" as a png.

                    • 7. Re: Export objects as PNG file
                      Felipe - dualpixel Level 3

                      Hi,

                      My solution works well for me.

                       

                      But, better export PDF, open in Photoshop or copy to Illustrator save in PDF...these way are very long

                      I was doing copy / paste the element to Photoshop. It's will as a smart object, then save as PNG...faster

                      • 8. Re: Export objects as PNG file
                        Eugene Tyson Adobe Community Professional & MVP

                        Copying and pasting is not a good idea.I noticed that text wraps are not honoured when you copy and paste from InDesign to Photoshop. I don't know what else is not supported, but that's at least one thing.

                         

                        The best bet is to export to PDF - then open that in photoshop - then save as a PNG.

                        • 9. Re: Export objects as PNG file
                          [Jongware] Most Valuable Participant

                          Here is a Javascript that'll do that. It only works on a single object, so if you want to export multiple items, you have to group them first.

                           

                          The PNG export is, as said above, sort of a hidden feature and as such it doesn't have any parameters. However, by simply trying I found the 'export resolution' is set to 72 dpi. Adobe believes everyone is still working at a fixed 72 dpi in the 21st century! So if you need another resolution -- quite likely -- you have to trick InDesign in believing the image is larger than it actually is.

                          The downside of this is, naturally, this fake resolution is not saved into the PNG file. Then again it shouldn't matter because ePub viewers don't use image resolution anyway.

                           

                          //DESCRIPTION:Export selected object to PNG
                          // A Jongware Script 28-Dec-2011
                          // A Do Not Complain If Your Hard Disk Crashes production
                          // Uses unsupported features, modifies your document, May Contain Bugs etc.
                          if (app.selection.length == 1)
                          {
                                    rez = prompt ("Resolution: ", "72");
                                    if (rez)
                                    {
                                              rez = Number(rez)/72;
                                              writeFile = File.saveDialog( 'Save PNG as:' )
                                              if (writeFile)
                                              {
                                                        app.selection[0].transform (CoordinateSpaces.INNER_COORDINATES,AnchorPoint.CENTER_ANCHOR, [rez,0,0,rez,0,0]);
                                                        app.selection[0].exportFile(ExportFormat.PNG_FORMAT, writeFile);
                                                        app.activeDocument.undo();
                                              }
                                    }
                          }
                          
                          • 10. Re: Export objects as PNG file
                            [Jongware] Most Valuable Participant

                            Uh. I may seem to contradict myself with

                             

                            ... Then again it shouldn't matter because ePub viewers don't use image resolution anyway.

                             

                            and then asking for the image resolution in the script.

                             

                            It would be easy to ask for target dimensions instead (in pixels), but if you want to export different sized images, you would need to calculate the target width and/or height for each separate image. By asking for this purely hypothetical resolution, if you use the same value for all of your exports, the relative sizes of each of your PNGs will be the same as the originals in your ID document.

                            • 11. Re: Export objects as PNG file
                              [Jongware] Most Valuable Participant

                              Hah -- and you may get weird results if you try it on text frames

                               

                              The script scales your selection up by a factor of resolution/72. It should not have any effect on its contents, but

                               

                              (1) on the adjecent page I had an object with Text Wrap applied, and of course scaling the frame up made the text re-wrap. Embarrassed look on my face 'cause I got a big blank space in the middle of my PNG and it took me all of 2 minutes to find out why that happened.

                               

                              (2) Strangely, re-sizing a text frame in the middle of a threaded story caused the text to re-flow. The original text in that frame scaled, but a couple of words of the previous and next frame crept in at their original size.

                               

                              Lesson Learned: if you are going to use it on a text frame, create a new document and copy the frame into that.

                              • 12. Re: Export objects as PNG file
                                Laubender Adobe Community Professional & MVP

                                Eugene wrote:

                                The best bet is to export to PDF - then open that in photoshop - then save as a PNG.

                                True.

                                 

                                The problems with single objects selected to export to PDF are:
                                1. How to exclude masterpage items

                                2. How to deal with objects that interact graphically with the selected object (obscuring the selection, changing its color because of overprint is true etc.pp.)

                                3. How to determine the right bounding box for the exported PDF (as a start it will always be the whole page with or without bleed or slug area; unfortunately scripting can nothing do about that fact even if you apply "exportFile()" to a group of your selected items)

                                 

                                There are scripts around who deal with all three problems one or another way, but they are far from being perfect.


                                A perfect script would:

                                1. Apply the [None] masterpage before exporting (but we can question that, if the selection is graphically in interaction with a masterpage item).

                                 

                                2. Set all not selected objects to "No Printing" to single out the wanted selection (we could also question that. Same  reason as in issue 1).

                                Ann.: Copying the selection to another document to single out the selection is no option (text applied to baseline grid, text wrap, threaded text frames)

                                 

                                3. Determine the right bounding box, equal if a selected text frame is affected by a text wrap, a baseline shift would extend text accross the bounds of the selected text frame, effects like drop shadows are applied, etc.pp.
                                Ann.: Copying the selection to another document to get the bounds right is no option (drop shadows and other effects, text applied to baseline grid etc.pp.)

                                 

                                This is not trivial and could possibly achieved only by rendering the whole exported PDF page in PhotoShop, making a selection of all transparent parts of the rendered layer and writing the bounds of that selection back to InDesign. None of the scripts I see is able to do that.

                                 

                                4. Finally: reset the document status and delete all intermediate files (PDFs or PSDs)

                                 

                                But here we finally have a "road map" to such a script

                                 

                                OR: Adobe could give us an altered export feature…

                                 

                                Uwe