C++ Class Library

The LEADTOOLS C++ Class Library is a wrapper to the LEADTOOLS C API and provides only a subset of the features and functionality otherwise available in the LEADTOOLS C API. For more information about the full feature set of the LEADTOOLS C API, refer to LEADTOOLS C API Introduction.

Is this page helpful?

In this page

LFileSettings::SetSaveResolution

Summary

Sets resolutions for the next save operation.

Syntax

#include "ltwrappr.h"

static L_INT LFileSettings::SetSaveResolution(uCount, pResolutions)

Parameters

L_UINT uCount

Specifies the number of resolutions to be saved in a file. Or, specify 0 to save only the actual size of the image as a single dimension in the file.

pDIMENSION pResolutions

Pointer to the array of DIMENSION structures which hold the resolutions to be saved.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

Currently, this function only works with the JBIG format.

A JBIG, FlashPix or PhotoCD file can contain more than one copy of the same image, each at a different physical resolution (width and height in pixels).

For JBIG files, uCount refers to the number of resolution layers to be saved in the file. The maximum number of resolutions that can be saved is 29.

For a JBIG file, the values of different resolutions are implied because the dimensions of each resolution layer are half the dimensions of the one directly above it.

pResolutions[0] is used to determine the highest resolution layer which will be saved in a file. You can fill pResolutions[0] with an actual width and height, or you can fill either the width or height with a valid value, and specify 0 for the other dimension to allow LEADTOOLS to calculate that dimension based on the image's aspect ratio during the next save operation. Note that for JBIG, all the values set in pResolutions are stored, but only pResolutions[0] is used during an actual file save process.

Ex.

uCount = 3
pResolution[0].nWidth = 800
pResolution[0].nHeight = 0

If you then save an image that is 1600 x 1200, the resolutions that are stored in the file would be:

800 x 600

400 x 300

200 x 150

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

This example saves the same image in three different resolutions and in three different files.

Copied to clipboard
L_INT LFileSettings__SetSaveResolutionExample() 
{ 
   L_INT nRet; 
   LFileSettings FileSet; 
   pDIMENSION pRes; 
   HGLOBAL hRes; 
   L_INT x; 
 
   hRes = GlobalAlloc(GMEM_MOVEABLE, sizeof(DIMENSION)* 4); 
 
   pRes = (pDIMENSION)GlobalLock( hRes ); 
 
   /* store four resolution layers */ 
 
   for(x=0;x<4;x++) 
 
   { 
 
      pRes[x].nWidth  = (int)(1600/(x+1)); 
 
      pRes[x].nHeight = (int)( 800/(x+1)); 
 
   } 
 
   nRet = FileSet.SetSaveResolution(4, pRes); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   GlobalUnlock (hRes); 
 
   GlobalFree (hRes); 
 
   return SUCCESS; 
} 

Help Version 22.0.2023.2.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.