OptimizeBuffer method (ILEADRasterImgOpt)
short OptimizeBuffer(ILEADRasterVariant *pOriginalBuffer, ILEADRasterVariant **pOptimizedBuffer, ILEADOptimizeOptions * pOptimizeOptions, VARIANT_BOOL bOptimizeEvent); | |
Overview |
Refer to Image Optimization. |
Remarks
Optimizes a supported image format buffer and reduces its size using the passed optimization options.
The method will initialize the pOptimizedBuffer to hold the optimized image. Note that the image buffer to be optimized should be one of the LEAD Image Optimizer Supported Formats, otherwise the method will return an error.
You can optimize an image buffer in memory as follows:
1. |
Save the image to be optimized (the original image) in memory. Use the SaveArray method to get the result in an ILEADRasterVariant variable. Pass this variable as the pOriginalBuffer parameter. |
2. |
Declare a variable of type ILEADRasterVariant and pass it as the pOptimizedBuffer parameter. This method will create it, if it’s not created, and fill it with the optimized image. |
3. |
Determine the optimization options to use, by doing one of the following: |
|
Pass NULL to the pOptimizeOptions parameter to optimize the image buffer using the default optimization options. |
|
Get the default optimization options by calling the DefaultOptions method, and update the values. Pass the updated optimization options to the pOptimizeOptions parameter. |
4. |
Call this method to optimize the image buffer and update the pOptimizedBuffer with the optimized buffer. |
See Also
Elements: |
JPEGQFactor property, PNGQFactor property, JPEGColorSpace property, Percent property, Distance property, PickSamePalette property, OptimizeDir method. OnOptimize event |
Topics: |