7 Replies Latest reply on Sep 1, 2015 2:06 AM by christianbrugeron

    default resolution when exporting as png

    christianbrugeron Level 1

      Hi

       

      We are using cc2014 and cc2015 and both have not a way for setting PNG export resolution. We must rely on a previous export by the user. If not set, it takes a long time to export ununusable 112bytes PNG files!

       

      Any way to avoid that?

       

      Thanks

       

      Christian

        • 1. Re: default resolution when exporting as png
          Toto RoToTO Level 3

          Hi,

           

          Which method of which suite are you actually using for making your export?

          There is definitely a way to set resolution parameter depending on how you do that.

           

          Best regards,

          Thomas.

          • 2. Re: default resolution when exporting as png
            christianbrugeron Level 1

            Hi

             

            Here is my code:

             

            err = sAIActionManager->AINewActionParamValue(&fActionParamValueRef);

            //ne doit pas être null,

            https://forums.adobe.com/thread/915571?start=0&tstart=0

                     err =

            sAIActionManager->AIActionSetStringUS(fActionParamValueRef,

            kAIExportDocumentNameKey, ai::UnicodeString(exportPath));

                     err =

            sAIActionManager->AIActionSetStringUS(fActionParamValueRef,

            kAIExportDocumentFormatKey, ai::UnicodeString("Adobe PNG Format"));

                     err = sAIActionManager->AIActionSetString(fActionParamValueRef,

            kAIExportDocumentExtensionKey, "png");

                     err =

            sAIActionManager->AIActionSetBoolean(fActionParamValueRef,

            kAIExportDocumentSaveAllKey, false);

                     err =

            sAIActionManager->AIActionSetBoolean(fActionParamValueRef,

            kAIExportDocumentSaveMultipleArtboardsKey, true);

                     err = sAIActionManager->AIActionSetString(fActionParamValueRef,

            kAIExportDocumentSaveRangeKey, range);

             

             

                     err =

            sAIActionManager->AIActionSetBoolean(fActionParamValueRef,

            kAIPDFRoundTripKey, false);

             

             

             

                     err =

            sAIActionManager->PlayActionEvent(kAIExportDocumentAction, kDialogOff,

            fActionParamValueRef);

             

             

            Without a proper manual initialisation by exporting a PNG (and

            correcting default values), exporting fails.

            The same is true with a fresh installation of Illustrator.

             

            Thank you for your help

             

            cb

             

            Le 24/08/2015 11:35, Toto RoToTO a écrit :

            >

                  default resolution when exporting as png

             

            created by Toto RoToTO <https://forums.adobe.com/people/Toto+RoToTO>

            in /Illustrator SDK/ - View the full discussion

            <https://forums.adobe.com/message/7892014#7892014>

             

            • 3. Re: default resolution when exporting as png
              LeoTaro Level 4

              Have you had a look at AIImageOptimization.h, which includes AIImageOptSuite::AsPNG and AIImageOptSuite::MakePNG24. I haven't used them myself, but they include arguments for setting parameters like resolution.

              • 4. Re: default resolution when exporting as png
                christianbrugeron Level 1

                I have heard of this suite but I think it is note related to the export actions.

                Do I have to rewrite the export code?

                 

                cb

                • 5. Re: default resolution when exporting as png
                  Toto RoToTO Level 3

                  As leoTaro said, you should definitely take a look at AIImageOptimization.h and use MakePNG24 method.

                  Take a look at AIImageOptPNGParams2 and AIImageOptPNGParams structs, which are used by MakePNG24.

                  This way you could set the image resolution

                   

                  AIErr result = kNoErr;

                  AIDataFilter* dstFilter = 0;

                  AIDataFilter* filter = 0;

                  ......

                   

                  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;

                   

                  AIImageOptPNGParams2 params;

                  params.versionOneSuiteParams.interlaced = ...;

                  params.versionOneSuiteParams.numberOfColors = ....;

                  params.versionOneSuiteParams.transparentIndex = ...;

                  params.versionOneSuiteParams.resolution = 300;

                  params.versionOneSuiteParams.outAlpha = ...;

                   

                  params.antialias = ConfigurationManager::GetAntialias();

                  /* A cropping box for the art. If empty or degenerate, do not crop. */

                  params.cropBox = bounds;

                  params.backgroundIsTransparent = ConfigurationManager::GetBackgroundIsTransparentProperty();


                  result = sAIImageOpt->MakePNG24 (art, dstFilter, params, MyRasterizeProgressProc);

                  aisdk::check_ai_error(result);


                  ....


                  if (dstFilter)

                  {

                    result = sAIDataFilter->UnlinkDataFilter (dstFilter, &dstFilter);

                    aisdk::check_ai_error(result);

                  }

                   

                   

                  I hope this will be helpful.

                   

                  Thomas.

                  • 6. Re: default resolution when exporting as png
                    Toto RoToTO Level 3

                    So, is it working?

                    Did you use MakePNG24 ?

                    • 7. Re: default resolution when exporting as png
                      christianbrugeron Level 1

                      I was on another project, i'll try this afternoon (Paris time).

                       

                       

                      Thanks

                      Christian Brugeron

                      christian@docinfo.fr

                       

                      Le 01/09/2015 10:43, Toto RoToTO a écrit :

                      >

                            default resolution when exporting as png

                       

                      created by Toto RoToTO <https://forums.adobe.com/people/Toto+RoToTO>

                      in /Illustrator SDK/ - View the full discussion

                      <https://forums.adobe.com/message/7918383#7918383>