Highlighted

How to Rasterize the ai File in Grayscale

Community Beginner ,
Aug 05, 2020

Copy link to clipboard

Copied

Dear Friend,

       How to Rasterize the ai Files in  Grayscale Using the function sAIRasterize->Rasterize().

If anybody knows the Rasterize the ai file. please guide me.

 

Regards,

Jayashree.J

TOPICS
SDK

Views

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

How to Rasterize the ai File in Grayscale

Community Beginner ,
Aug 05, 2020

Copy link to clipboard

Copied

Dear Friend,

       How to Rasterize the ai Files in  Grayscale Using the function sAIRasterize->Rasterize().

If anybody knows the Rasterize the ai file. please guide me.

 

Regards,

Jayashree.J

TOPICS
SDK

Views

68

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
Aug 05, 2020 0
Participant ,
Aug 06, 2020

Copy link to clipboard

Copied

You can use Rasterize Suite. You should call AIRasterizeSuite::Rasterize() with AIRasterizeSettings provided, where you can set type (AIRasterizeType) to kRasterizeGrayscale.

 

Quick example:

 

group should bee existing AIArtHandle - with type kGroupArt

 

 

AIErr error;
AIRasterizeSettings settings;
AIColorConvertOptions colorConvertOptions;
AIArtHandle art;

settings.type = kRasterizeGrayscale;
settings.resolution = <desired resolution>; // here enter resolution
settings.antialiasing = 5;
settings.options = kRasterizeOptionsDoLayers;
settings.ccoptions = colorConvertOptions;
settings.preserveSpotColors = true;

error = sAIRasterize->Rasterize(
  artSet,
  &settings,
  &rect,
  kPlaceInsideOnTop,
  group,
  &art,
  NULL,
);

 

 

 

You will then get art with type kRasterArt. You can write it to file with compression (JPEG, PNG) using Data Filter Suite.

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
Reply
Loading...
Aug 06, 2020 0
Community Beginner ,
Aug 06, 2020

Copy link to clipboard

Copied

Thanks for your reply..!

I tried these code but Error is occur

Please clarify the below code has any mistake.

 

AppContext appContext(g_SPPluginRef);
AIErr result = kNoErr;
ArtMatcher artMatcher(1);
artMatcher.SetSpec(0, kAnyArt, 0, 0);
artMatcher.GetMatchingArt();
AIArtSet artset;
sAIArtSet->NewArtSet(&artset);
AIRealRect artBounds;
for (int nIndex = 0; nIndex < artMatcher.GetNumMatches(); ++nIndex)
{
short type;
ai::FilePath fPath;
AIArtHandle art = artMatcher.GetMatchedArt(nIndex);
sAIArt->GetArtType(art,&type);

sAIArtset->AddArtToArtSet(artset, art);
}
AIArtHandle artHandle, rasterHandle;
sAIArt->GetFirstArtOfLayer(NULL, &artHandle);
AIRasterizeSettings settings;
AIColorConvertOptions colorConvertOptions;
AIArtHandle art;

settings.type = kRasterizeGrayscale;
settings.resolution = 72; // here enter resolution
settings.antialiasing = 5;
settings.options = kRasterizeOptionsDoLayers;
settings.ccoptions = colorConvertOptions;
settings.preserveSpotColors = true;

result = sAIRasterize->Rasterize(
artset,
&settings,
&artBounds,
kPlaceInsideOnTop,
artHandle,
&art,
NULL
);

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
Reply
Loading...
Aug 06, 2020 0
MilosR LATEST
Participant ,
Aug 07, 2020

Copy link to clipboard

Copied

I forgot to mention you about ArtSet, but I see you find it out. You didn't set artBounds, call AIRasterizeSuite::ComputeArtBounds to calculate art bounds. Which error code you get?

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
Reply
Loading...
Aug 07, 2020 0