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

Raster Selection

Participant ,
Nov 15, 2016 Nov 15, 2016

Is there a way to raster selection, or do I have to create layers/groups and move them group by group?  Just thought I would ask if it's possible before diving in. Thought something like this may work but I get an illegal argument when running.

idoc.rasterize( selection, rasteroptions);

TOPICS
Scripting
1.2K
Translate
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
Engaged ,
Nov 16, 2016 Nov 16, 2016

jeremy0013 hello!

You are trying to pass a special object selection, but the method 'Document.rasterize()' expects source art(s):

activeDocument.rasterize(selection[0]);

Translate
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
Valorous Hero ,
Nov 16, 2016 Nov 16, 2016

I think you have to move them into a group, or use an action to rasterize without having to move into a group.

On an added note:

app.executeMenuCommand("raster"); <-- this actually puts the preview to Pixel preview!

and:

app.executeMenuCommand("Rasterize 8 menu item"); <-- this activates the Rasterize dialog, but cannot be done without the dialog, hence why you have to do the action.

Translate
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 ,
Nov 16, 2016 Nov 16, 2016

  Thanks O and V for your reply.  I have been messing around with O's solution due to having a non user interface.  I think the objects will have to be grouped before rasterization as when rasterizing it only does one object and not all.  And here comes the next question, how to move the selected objects to a layer after grouping  them so that the groups can be rasterized one at a time. Any help would be appreciated.

var newoptions = new RasterizeOptions;

newoptions.resolution = 150;

newoptions.transparency = true;

function SelectRaster() {

    var idoc = activeDocument;

    var artbs = idoc.artboards;

    for (var i = artbs.length-1 ; i >= 0; i--) {

        if (artbs.name != "Void") {

            artbs.setActiveArtboardIndex(i);

            idoc.selectObjectsOnActiveArtboard();

         

           //Layer and sort groups.

    }}

};

SelectRaster();

Rasterize layer groups. Already have this part figured out.

Translate
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 ,
Nov 16, 2016 Nov 16, 2016

What is the purpose of all these manipulations? Describe your problem completely, please.

Translate
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 ,
Nov 16, 2016 Nov 16, 2016

I have multiple artboards with layered graphics I need to flatten and rasterize per artboard.  Make sense.  The rasterization I already have figured out but need to group the selection of each artboard and get it to a layer for rasterization.  I guess this could all be done with one function but my javascript skills are not that far along yet.

update: Almost have it. Moving artboard objects to layer, rasterizing on to the next artboard. V was right, have to group objects before rasterizing.

Translate
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 ,
Nov 16, 2016 Nov 16, 2016
LATEST

/**

* group all anlock and visible items on each top-layers

* compatible CS6+

*

* @param {Document} d - object of Illustrator DOM Document class

* */

function groupOnLays(d) {

  executeMenuCommand('deselectall');

  var lays = d.layers;

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

    var lay                = lays;

    lay.hasSelectedArtwork = true;

    executeMenuCommand('group');

    lay.hasSelectedArtwork = false;

  }

}

groupOnLays(activeDocument);

Translate
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