Skip to main content
Tychonoir
Known Participant
October 18, 2016
Question

Export Symbols as PNG Script (with resolution)

  • October 18, 2016
  • 3 replies
  • 2704 views

I'm trying to find a way to export a number of symbols as separate PNGs, at 300 dpi quality.

So far I've found a number of scripts that come close, but typically, they all export at 72 dpi and the options of those methods don't support resolution.
ExportType.PNG24 does support horizontalScale and verticalScale, and setting these to 400 is close, but not the same thing and just causes workflow bottlenecks in another place.

I've seen some scripts use imageCapture which does have an option for setting resolution, but these seem to also require getting the rectSize of the artwork to export. The rect size should be of that of the symbol, and I'm not sure how to pass that info.

I saw one script that used the artboard size, and as the symbols will never have their own artboard, that's just not going to work.

Any ideas?

This topic has been closed for replies.

3 replies

Participant
February 25, 2022

Hello team,

 

There is a super simple way.... 😄

 

  • Window > Asset Export
  • Drag a grouped graphic or symbol into the Asset Export panel.
  • Choose the Export Settings (eg. Scale: 300ppi, Format: png)
  • Click 'Export'
  • These will save into a folder named '300ppi'

 

....You're welcome!

Silly-V
Legend
October 18, 2016

You can just use the symbol's bounds for imageCapture.

o-marat
Inspiring
October 19, 2016

Silly-V, thanks! In fact, this way is most short, simple and compatible!

(function captureSymbols() {

  var d = activeDocument,

      pth  = d.fullName + '',

      opts = new ImageCaptureOptions();

  opts.resolution   = 300;

  opts.antialiasing = true;

  opts.transparency = true;

  for (var i = 0; i < d.symbolItems.length; i++) {

    try {

      var symb      = d.symbolItems;

      symb.selected = true;

      symb.selected = false;

      d.imageCapture(

        new File(pth.slice(0, pth.lastIndexOf('.')) + '_' + i + '.png'),

        symb.geometricBounds,

        opts

      );

    } catch (e) {

    }

  }

}());

Silly-V
Legend
October 20, 2016

Cool, do you have to be selecting and deselecting the symbol, or is that just for a visual aid or something?

o-marat
Inspiring
October 18, 2016

As one of the possible variants of Illustrator script algorithm:

  • Save as a pdf
  • Then, through Photoshop, open the pdf and save it in png (through BridgeTalk Class)
Tychonoir
TychonoirAuthor
Known Participant
October 18, 2016

The idea of opening hundreds of PDFs in Photoshop isn't terribly appealing. I'm not sure what BridgeTalk is (I've never used Bridge), but maybe you're proposing a second layer of automation.

But as it turns out, Google Docs doesn't seem to know the difference between resolution and size, so the whole thing is moot anyway. Since it incorrectly assumes all images are at screen resolution, and there's no way to specify a specific numeric size, using 400% size works the same. At least while I'm using Google Docs.

Larry G. Schneider
Community Expert
Community Expert
October 18, 2016

The actual percentage for 300 ppi equivalence is 416.67.