Skip navigation
Hitz_M
Currently Being Moderated

outWidth and outHeight dont work for AIImageOptSuite

Mar 25, 2010 6:47 AM

Hello,

 

While using the AIImageOptSuite.MakePNG24 and AIImageOptSuite.AsJPEG, the width and height of the generated image is not the value set in

AIImageOptJPEGParams.outWidth and AIImageOptJPEGParams.outHeight.

 

My code is:

 

AIImageOptJPEGParams jpegParams;

jpegParams.resolution = 200;

jpegParams.blurAmount = 0;

jpegParams.quality = 100;

jpegParams.kind = AIImageOptJPEGStandard;

jpegParams.scans = 1;

jpegParams.outAlpha =

false;

jpegParams.outHeight = 1200;

jpegParams.outHeight = 1200;

 

//Generates the jpg for a layer specified by layerArt

result= sAIImage->AsJPEG(layerArt, dstfilter, jpegParams);

 

 

 

The size of the output image is random and depends on the contents of the layer.

I am using CS3 SDK.

 

Thanks,

Hitesh

 

 
Replies
  • Currently Being Moderated
    May 5, 2010 4:09 AM   in reply to Hitz_M

    What about the other options you're setting? What is "result"?

     

    In the code you posted, you set jpegParams.outHeight twice.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 23, 2010 4:06 AM   in reply to Hitz_M

    Have you tried setting a different resolution? Does that affect the results?

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 23, 2010 7:40 AM   in reply to btemp

    Another thing to try is screwing with the Document Raster settings, see if that affects things or not. If they do, there might be something else we can try.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 26, 2010 1:38 AM   in reply to Hitz_M

    See here for details on reading/changing the document raster settings.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 18, 2012 11:34 PM   in reply to Hitz_M

    Hi Hitesh,

     

    I am working on the same thing as you were...

     

     

    Can you please tell me that what are

     

    •      result= sAIImage->AsJPEG(layerArt, dstfilter, jpegParams);

     

    in your code.

     

    Thanks

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 1, 2013 4:13 AM   in reply to Hitz_M

    I experienced the same problem of AIImageOptSuite.

    But stepping through the code I suddenly noticed that outWidth and outHeight was changed after the call.

    So outWidth and outHeight are "out parameters" that callee sets, while outAlpha seems not.

     

    If you want 1200px width image, you may have to calc the resolution like (1200.0 / art_width * 72), or keep the resolution 72 and scale the Art itself in advance.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 8, 2013 1:02 AM   in reply to ranvis.

    just take a look at AIImageOptParams struct defined in AIImageOptimization.h and you will notice outWidth and outHeight are out parameters. What outAlpha is not.

     

    /** PNG parameters for image optimization. See \c #AIImageOptSuite and

    additional parameters in \c #AIImageOptPNGParams2. */

    struct AIImageOptPNGParams {

    /** When true, the input image is interlaced. */

    AIBool8 interlaced;

    /** The number of colors in the input image, in the range [2..255]. */

    ai::int32 numberOfColors;

    /** The transparency index of the input image, in the range [0..numberOfColors-1]. */

    ai::int32 transparentIndex;

     

    /** The image resolution, in pixels per inch, of the input image.   */

    AIFloat resolution;

    /** When true, include an alpha channel in the output image. */

    AIBool8 outAlpha;

    /**  The width in pixels of the output image. */

    ai::int32 outWidth;

    /** The height in pixels of the output image. */

              ai::int32 outHeight;

    };

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points