• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Exporting all selected objects as individual separate png files

Participant ,
Oct 17, 2018 Oct 17, 2018

Copy link to clipboard

Copied

I'm looking for a way, possibly via a script, to export all selected objects on an InDesign page as individual separate PNG files.

The linked method via html export doesn't work for my objects that are text within a rectangle frame (for png buttons). The html export treats that as text and not an image. Is there a script or other way of exporting all selected objects to png files? I'd like to keep the text live if possible. Thanks!

Exporting all selected objects as individual separate png files

TOPICS
Scripting

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Oct 18, 2018 Oct 18, 2018

Are you aware that PNG is a bitmap format? This

https://forums.adobe.com/people/Dan+Niemi  wrote

I'd like to keep the text live if possible ...

ain't gonna happen. Apart from that, this seems to suffice:

for (s=0; s<app.selection.length; s++)

app.selection.exportFile(ExportFormat.PNG_FORMAT, File(new File(Folder.myDocuments+"/image_"+s+".png")));

Result: the top 3 selected objects -- a text frame, a group, and a standalone image -- get exported to 3 images:

Votes

Translate

Translate
Participant ,
Oct 17, 2018 Oct 17, 2018

Copy link to clipboard

Copied

Outline the text so they become essentially static objects and not font-based text.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 18, 2018 Oct 18, 2018

Copy link to clipboard

Copied

Are you aware that PNG is a bitmap format? This

https://forums.adobe.com/people/Dan+Niemi  wrote

I'd like to keep the text live if possible ...

ain't gonna happen. Apart from that, this seems to suffice:

for (s=0; s<app.selection.length; s++)

app.selection.exportFile(ExportFormat.PNG_FORMAT, File(new File(Folder.myDocuments+"/image_"+s+".png")));

Result: the top 3 selected objects -- a text frame, a group, and a standalone image -- get exported to 3 images:

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 18, 2018 Oct 18, 2018

Copy link to clipboard

Copied

This is perfect, thank you!

Yup, I'm aware png is bitmap, I just needed to keep it live in the actual indesign document. (not outlining)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 18, 2018 Oct 18, 2018

Copy link to clipboard

Copied

Ah, you meant the other way around! No worries there, this export does not change a thing in the original file.

This PNG export uses a default value for dpi; I did not look it up but I think later versions of InDesign allow you to use custom values. So if you find you need larger images, say the word and someone might know where to find it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 18, 2018 Oct 18, 2018

Copy link to clipboard

Copied

Thanks again! Your scripting assistance to others has helped me countless times as I'm learning.

this line works for me for resolution:

app.pngExportPreferences.exportResolution = 72;

My only issue that I see is that the exported size doesn't match the size of the object. For example, this object below is 100x40, but the exported png for the 2 objects is 100x44 and 100x42, respectively. Is there something that would cause this discrepancy (2 lines of text vs 1 is the only difference between the 2)

If this is a separate issue, feel free to close and I can ask on a separate thread.

Screen Shot 2018-10-18 at 8.56.47 AM.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 18, 2018 Oct 18, 2018

Copy link to clipboard

Copied

LATEST

InDesign is a horrible application to use pixels in. It's just not what it was designed for. It can work highly accurately in points, millimeters, and imperial inches, with a mind boggling accuracy (near to the wavelength of visible light!) ... but the "pixel" is not a real world unit. If it were, you could have your length on your driver's license in pixels.

In your case I'd sooner believe that the size of the exported PNG images is "more correct" than what InDesign itself thinks it is, but of course it is not so simple. Then again, I've never willingly used InDesign to create PNG files with, so I am at a loss here. (I'd prefer Photoshop -- or even Illustrator! -- over InDesign, for any pixel related work.)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines