Skip to main content
Inspiring
March 22, 2018
Answered

Raster resolution

  • March 22, 2018
  • 1 reply
  • 911 views

Hi, I'm trying to create a script that will rasterize an object with certain resolution, but to no avail, what am I doing wrong, can anyone give me a hint?

#target illustrator

function rasterItem() {

    var sourceDoc = app.activeDocument;

    var currentItem = sourceDoc.pathItems[0]

    var resolucao = rasterizeOptions.resolution = (resolution / 72) * 400;

    currentItem.selected = true; 

    activeDocument.rasterize( currentItem, currentItem.visibleBounds, resolucao ); 

rasterItem();

This topic has been closed for replies.
Correct answer CarlosCanto

function rasterItem() {

    var sourceDoc = app.activeDocument;

    var currentItem = sourceDoc.pathItems[0]

   

    var rasterOpts = new RasterizeOptions;

    rasterOpts.resolution = 96; //(resolution / 72) * 400;

    currentItem.selected = true;

    activeDocument.rasterize( currentItem, currentItem.visibleBounds, rasterOpts );

}

rasterItem();

1 reply

CarlosCanto
Community Expert
CarlosCantoCommunity ExpertCorrect answer
Community Expert
March 22, 2018

function rasterItem() {

    var sourceDoc = app.activeDocument;

    var currentItem = sourceDoc.pathItems[0]

   

    var rasterOpts = new RasterizeOptions;

    rasterOpts.resolution = 96; //(resolution / 72) * 400;

    currentItem.selected = true;

    activeDocument.rasterize( currentItem, currentItem.visibleBounds, rasterOpts );

}

rasterItem();

Inspiring
March 22, 2018

It worked perfectly, I did not know how to set the resolution option

Very thanks!