Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
0

High RAM-Usage when exporting to PNG (resulting in [IMer]-ImageOptimizationError)

Guest
Oct 19, 2011 Oct 19, 2011

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

TOPICS
SDK
10.5K
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
Guest
Dec 30, 2011 Dec 30, 2011

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?

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
Enthusiast ,
Jan 03, 2012 Jan 03, 2012

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.

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
Guest
Jan 03, 2012 Jan 03, 2012

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!!

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
Enthusiast ,
Jan 04, 2012 Jan 04, 2012

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.

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
Enthusiast ,
Jan 04, 2012 Jan 04, 2012

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;

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
New Here ,
Sep 26, 2012 Sep 26, 2012
LATEST

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.

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