LBitmapBase::Size

#include "ltwrappr.h"

virtual L_INT LBitmapBase::Size(nWidth, nHeight, uFlags=SIZE_NORMAL)

L_INT nWidth;

/* new width of the bitmap in pixels */

L_INT nHeight;

/* new height of the bitmap in pixels */

L_UINT32 uFlags;

/* flag that indicates how to resize */

Resizes the class object's bitmap to a new width and height.

Parameter

Description

nWidth

New width of the bitmap in pixels.

nHeight

New height of the bitmap in pixels.

uFlags

Flag that indicates how to resize the bitmap. Possible values are:

 

Value

Meaning

 

SIZE_NORMAL

[0x0000] Resize normally.

 

SIZE_FAVORBLACK

[0x0001] (Document/Medical only) Preserve black objects when making the image smaller. This option affects only 1-bit, black-and-white images, where it prevents the disappearance of thin lines. You can use a bitwise OR ( | ) to combine this flag with another one. For example, SIZE_RESAMPLE | SIZE_FAVORBLACK causes color images to be resampled, but applies the favor-black option to 1-bit, black-and-white images.

 

SIZE_RESAMPLE

[0x0002] Use interpolation and averaging to produce a higher quality image.

 

SIZE_BICUBIC

[0x0004] Use bicubic interpolation and averaging to produce a higher quality image. This is slower than SIZE_RESAMPLE.

 

SIZE_SCALETOGRAY

[0x0008] (Document/Medical only). Use interpolation to display black and white images using shades of gray when the image is resized. This improves the readability when the image is scaled up or down. The generated image is 8-bit grayscale, so this option should be used only for black and white images.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Call this function to change the size of the class object's bitmap.

This function keeps the same bitmap handle and resizes the bitmap that it references. If you want to keep the original-size bitmap along with the resized bitmap, use the LBitmapBase::Resize function.

To update a status bar or detect a user interrupt during execution of this function, refer to LBase::EnableStatusCallBack.

Required DLLs and Libraries

LTDIS
LTFIL

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64.

See Also

Functions:

LBitmapBase::Resize, LBuffer::StartResize, LBuffer::Resize, LBuffer::StopResize, LBitmapBase::SizeInterpolate, Class Members

Topics:

Raster Image Functions: Doing Geometric Transformations

 

Resizing Considerations

 

Processing an Image

 

Raster Image Functions: Processing an Image

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
L_INT LBitmapBase__SizeExample()
{
   L_INT nRet;
   LBitmapBase MyBitmap;
   nRet =MyBitmap.Load(MAKE_IMAGE_PATH(TEXT("image1.cmp")));
   if(nRet !=SUCCESS)
      return nRet;
   nRet =MyBitmap.Size(100,100);
   if(nRet !=SUCCESS)
      return nRet;/*change the size of the bitmap object to 100x100  */
   
   nRet =MyBitmap.Free();
   if(nRet !=SUCCESS)
      return nRet;
   return SUCCESS;
}