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

Can't rasterize object with hole inside

New Here ,
Sep 08, 2014 Sep 08, 2014

Copy link to clipboard

Copied

Hello everyone.

I've used thisone part of script for rastering objects.

var docPathItems = app.activeDocument.pathItems;

var myDoc = app.activeDocument;

// If a docuement is open

if ( app.documents.length > 0 )

{

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

  {

  if (docPathItems.filled == true)

  {

  var rasterizeOptions = new RasterizeOptions;

  rasterizeOptions.antiAliasingMethod = AntiAliasingMethod.ARTOPTIMIZED;

  rasterizeOptions.backgroundBlack = false;

  rasterizeOptions.clippingMask = true;

  //rasterizeOptions.colorModel = RasterizationColorModel.GRAYSCALE;

  rasterizeOptions.convertSpotColors = false;

  rasterizeOptions.convertTextToOutlines = false;

  rasterizeOptions.includeLayers = false;

  rasterizeOptions.padding = 0;

  rasterizeOptions.resolution = 300;

  rasterizeOptions.transparency = true;

  myDoc.rasterize(docPathItems, docPathItems.controlBounds,rasterizeOptions);

  }

  }

}

If object dont have hole inside (for example picture). It work ok.

Screenshot_2.png

BUT if its hole inside (for example picture) - I have error.

Screenshot_3.png

So.. error 

Screenshot_4.png

Screenshot_5.png

Who know what does it mean???

TOPICS
Scripting

Views

449

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
Valorous Hero ,
Sep 09, 2014 Sep 09, 2014

Copy link to clipboard

Copied

Is that because it's a Compound Path and doing just one part of it will give an error?  If so, you'd need to do rasterize for the compoundPathItems of the doc 1st, then repeat with the pathItems second.

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
New Here ,
Sep 24, 2014 Sep 24, 2014

Copy link to clipboard

Copied

Thank u for answer,

So, How can i find only compundPathItems in cycle?

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
New Here ,
Sep 24, 2014 Sep 24, 2014

Copy link to clipboard

Copied

LATEST

Thank u one more time.

I've found how to find only compoundPath objects.

If someone have the same problem, there is code of my decision

var docPathItems = app.activeDocument.pathItems;

var docCompPathItems = app.activeDocument.compoundPathItems;

var myDoc = app.activeDocument;

// If a docuement is open

if ( app.documents.length > 0 )

{

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

  {

  var rasterizeOptions = new RasterizeOptions;

  rasterizeOptions.padding = 0;

  rasterizeOptions.resolution = 300;

  rasterizeOptions.transparency = true;

  myDoc.rasterize(docCompPathItems, docCompPathItems.controlBounds,rasterizeOptions);

  }

}

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