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

How to export contents of a artset as png?

Engaged ,
Sep 07, 2016 Sep 07, 2016

Copy link to clipboard

Copied

Hi

I want to export the contents of a artset as jpg. I am rasterizing the artset and then exporting it as JPG. But nothing happens.

Here is the code,

AIRasterizeSettings rastSettings;

AIArtHandle tempRaster = 0;

AIArtHandle layerGroup = 0;

error = sAIArtSet->IndexArtSet(artSet, 0, &layerGroup);

AIRealRect bounds;

error = sAIRasterize->ComputeArtBounds(artSet, &bounds, false);

rastSettings.type = kRasterizeRGB;

rastSettings.resolution = 72;

rastSettings.antialiasing = 2;

rastSettings.options = kRasterizeOptionsNone;

error = sAIRasterize->Rasterize(artSet, &rastSettings, &bounds, kPlaceInsideOnTop, layerGroup, &tempRaster, 0);

ai::FilePath ioFilePath(ai::UnicodeString("D:\\Samples\\TestSample\\export\\1.png"));

AIDataFilter* dstfilter = NULL;

AIDataFilter* filter = NULL;

error = sAIDataFilter->NewFileDataFilter(ioFilePath, "write", 'prw', 'PNGf', &filter);

error = sAIDataFilter->LinkDataFilter(dstfilter, filter);

dstfilter = filter;

AIImageOptPNGParams2 params;

params.versionOneSuiteParams.interlaced = true;

params.versionOneSuiteParams.transparentIndex = 0;

params.versionOneSuiteParams.resolution = 300;

params.versionOneSuiteParams.outAlpha = false;

params.antialias = 0;

params.cropBox = bounds;

params.backgroundIsTransparent = true;

error = sAIImageOpt->MakePNG24(tempRaster, dstfilter, params, NULL);

I get an exception in the last line "MakePNG24".

What am I missing?

TOPICS
SDK

Views

956

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
Engaged ,
Sep 07, 2016 Sep 07, 2016

Copy link to clipboard

Copied

What's the value of error?

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
Engaged ,
Sep 08, 2016 Sep 08, 2016

Copy link to clipboard

Copied

I get 1346458189 value in error.

Can it be possible that if any value in bounds is negative, then it gives error?

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
Participant ,
Sep 08, 2016 Sep 08, 2016

Copy link to clipboard

Copied

shouldnt all "versionOneSuiteParams" be filled?

params.versionOneSuiteParams.interlaced = ;

params.versionOneSuiteParams.numberOfColors = ;

params.versionOneSuiteParams.transparentIndex = ;

params.versionOneSuiteParams.resolution = ;

params.versionOneSuiteParams.outAlpha = ;

params.versionOneSuiteParams.outWidth = ;

params.versionOneSuiteParams.outHeight = ; 

params.antialias = ;

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
Engaged ,
Sep 08, 2016 Sep 08, 2016

Copy link to clipboard

Copied

1346458189 is 'PARM'. It looks like 'tempRaster' might not be initialized. I'm not sure if the RasterizeSuite->Rasterize(...) does that for you. Passing a null art handle in there is likely to cause problems.

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
Engaged ,
Sep 08, 2016 Sep 08, 2016

Copy link to clipboard

Copied

Also can't tell from that code snippet if you're initializing your ArtSet correctly. Perhaps MakePNG24(...) doesn't like being passed a NULL parameter for AIRasterizeProgressProc?

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
Participant ,
Sep 17, 2016 Sep 17, 2016

Copy link to clipboard

Copied

LATEST

Mr Big Templeton is absolutely right. AIRasterizeProgressProc shouldnt  be null or nil or 0 etc.

static AIBoolean progressProc(long current, long total)

{

return true;

}

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