Copy link to clipboard
Copied
Hello,
first of all the example of my source code:
if(myParams){
error = sAIActionManager->AIActionSetStringUS(myParams, kAIExportDocumentNameKey, ai::UnicodeString("C:\\test\\test2.png") );
error = sAIActionManager->AIActionSetString(myParams, kAIExportDocumentFormatKey, "Adobe PNG Format");
error = sAIActionManager->AIActionSetString(myParams, kAIExportDocumentExtensionKey, "png");
error = sAIActionManager->AIActionSetBoolean(myParams, kAIExportDocumentSaveAllKey, false);
error = sAIActionManager->AIActionSetBoolean(myParams, kAIExportDocumentSaveMultipleArtboardsKey, true);
error = sAIActionManager->AIActionSetString(myParams, kAIExportDocumentSaveRangeKey, "5");error = sAIActionManager->RecordActionEvent(kAIExportDocumentAction, kDialogOff, myParams);
if (sAIActionManager->InRecordMode){
sAIActionManager->PlayActionEvent(kAIExportDocumentAction, kDialogOff, myParams);
}
}return kNoErr;
When calling PlayActionEvent it takes a long time and the RAM-Usage increases to more than 1 GB. Although the Illustrator-File is only 1,5 MB. The Destination-File (test2-05.png) doesn't exist, after the process is finished there is only a test2-05.png.tmp$$ File (0 bytes) an i get a Message with the Error Code: IMer.
How I can pass the sAIActionManager the ImageOptimization for a File? It is required to export exactly one Artboard!
Can anyone help me?
sicsone
Copy link to clipboard
Copied
I have a similar Problem. My PNG-Files are empty and I doesn't get an error message. I translated the error number it describe an IMer-Error too. It is an error in the ImageOpt.
Has anyone an idea please?
Copy link to clipboard
Copied
Have you tried using AIImageOptSuite (MakePNG24) instead to complete this?
Take a look at this suite, you will find what you are looking for.
I used both solutions, but finally I chose the last one.
Copy link to clipboard
Copied
Hi,
thank you for yout answer. Yes now it is so, that I use the method MakePNG24 fro the AIImageOptSuite. The problem I have now is, when the quality of the image is too high (eg. antialias = true and resolution 300).
Then the AIImageOptSuie creates PNG-Files with 0 Bytes. The AIImageOptSuite givs an errorcode. It is IMer. It's an error in the Image Optimization. And when I try it with the normal export function in the menubar, it export not all files, sometimes I get the same Exception from the Adobe Illustrator (native).
Some pictures are working fine and some not. Only if I take a low quality, It runs everytimes, but this is not the way I want go.
Do you have any ideas? Is it a bug in AI?
Thank you for request, and a happy new year from Germany - Dortmund!!
Copy link to clipboard
Copied
thank you for yout answer. Yes now it is so, that I use the method MakePNG24 fro the AIImageOptSuite. The problem I have now is, when the quality of the image is too high (eg. antialias = true and resolution 300).
You can set AIImageOptPNGParams2 properties to set those parameters:
ex:
params.versionOneSuiteParams.resolution = ......;
params.antialias = ......;
Just take a look at AIImageOptPNGParams2, there is a lot to be configured.
Then the AIImageOptSuie creates PNG-Files with 0 Bytes. The AIImageOptSuite givs an errorcode. It is IMer. It's an error in the Image Optimization. And when I try it with the normal export function in the menubar, it export not all files, sometimes I get the same Exception from the Adobe Illustrator (native).
Some pictures are working fine and some not. Only if I take a low quality, It runs everytimes, but this is not the way I want go.
Is the AIDataFilter used by the MakePNG24 method set correctly?
Have you set the crop property of AIImageOptPNGParams2 ? correctly set?
I used not to have such bugs for any art I wanted to export as PNG.
Regards,
Thomas.
Copy link to clipboard
Copied
this shoud be helpful:
AIErr result =kNoErr;
AIDataFilter* dstFilter = 0;
AIDataFilter* filter = 0;
ai::UnicodeString file(filepath); //file path c
ai::FilePath fileP(file);
try
{
result = sAIDataFilter->NewFileDataFilter(fileP, "write", 'prw', 'PNGf', &filter);
aisdk::check_ai_error(result);
result = sAIDataFilter->LinkDataFilter(dstFilter, filter);
aisdk::check_ai_error(result);
dstFilter = filter;
// still to be configured, with your own values!!
AIImageOptPNGParams2 params;
params.versionOneSuiteParams.interlaced = ;
params.versionOneSuiteParams.numberOfColors = ;
params.versionOneSuiteParams.transparentIndex = ;
params.versionOneSuiteParams.resolution = ;
params.versionOneSuiteParams.outAlpha = ;
params.versionOneSuiteParams.outWidth = ;
params.versionOneSuiteParams.outHeight = ;
params.antialias = ;
/* A cropping box for the art. If empty or degenerate, do not crop. */
params.cropBox = ;
params.backgroundIsTransparent = ;
result = sAIImageOpt->MakePNG24 (art, dstFilter, params, MyRasterizeProgressProc);
aisdk::check_ai_error(result);
if (dstFilter)
{
result = sAIDataFilter->UnlinkDataFilter (dstFilter, &dstFilter);
aisdk::check_ai_error(result);
}
}
catch(ai::Error& ex)
{
//Handle error
}
return result;
Copy link to clipboard
Copied
I didn't understand any of your coding, so that solution was out for me.
However, I was able to open the AI file directly into Photoshop as a Photoshop PDF and save it out as the PNG needed.
Thank you for having the question out there to be searched.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now