Export Symbols as PNG Script (with resolution)

Community Beginner ,
Oct 17, 2016 Oct 17, 2016

Copy link to clipboard

Copied

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?

TOPICS
Scripting

Views

954

Likes

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
Engaged ,
Oct 18, 2016 Oct 18, 2016

Copy link to clipboard

Copied

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)

Likes

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 Beginner ,
Oct 18, 2016 Oct 18, 2016

Copy link to clipboard

Copied

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.

Likes

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
Adobe Community Professional ,
Oct 18, 2016 Oct 18, 2016

Copy link to clipboard

Copied

The actual percentage for 300 ppi equivalence is 416.67.

Likes

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
Adobe Community Professional ,
Oct 18, 2016 Oct 18, 2016

Copy link to clipboard

Copied

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

Likes

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
Engaged ,
Oct 19, 2016 Oct 19, 2016

Copy link to clipboard

Copied

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

    }

  }

}());

Likes

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
Adobe Community Professional ,
Oct 20, 2016 Oct 20, 2016

Copy link to clipboard

Copied

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

Likes

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
Engaged ,
Oct 20, 2016 Oct 20, 2016

Copy link to clipboard

Copied

Oh! I think this is the rudiment of the other versions of the script, when I tried different export options.

By the way, for some reason, png-files, which are the result of saving pdf through Photoshop have a  very large size.

Although Photoshop saves PNG files much faster than Illustrator.

Likes

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
New Here ,
Feb 24, 2022 Feb 24, 2022

Copy link to clipboard

Copied

LATEST

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!

Likes

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