Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.11.1
LEADTOOLS Raster Imaging C DLL Help

L_SizeBitmapInterpolate

Show in webframe

#include "l_bitmap.h"

L_LTIMGCOR_API L_INT L_SizeBitmapInterpolate(pBitmap, nWidth, nHeight, uFlags)

pBITMAPHANDLE pBitmap;

/* pointer to the bitmap handle */

L_INT nWidth;

/* new width in pixels */

L_INT nHeight;

/* new height in pixels */

L_UINT uFlags;

/* quality control flags */

Resizes a bitmap to a new width and height.

Parameter

Description

pBitmap

Pointer to the bitmap handle referencing the bitmap to be resized.

nWidth

Value that represents the new width, in pixels.

nHeight

Value that represents the new height, in pixels.

uFlags

Flag that determines the resizing behavior. Possible values are:

 

Value

Meaning

 

SIZE_NORMAL

[0x0000] Resize normally. This is the fastest, but can cause aliasing.

 

SIZE_RESAMPLE

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

 

SIZE_BICUBIC

[0x0004] Use Bicubic interpolation and averaging to produce a high-quality image. This is slower than SIZE_BILINEAR.

 

SIZE_TRIANGLE

[0x0005] Use Triangular-peaked weighting average to produce a high-quality image.

 

SIZE_HERMITE

[0x0006] Use Hermite interpolation to produce a good quality image better than Bresenham interpolation but not as good as Bilinear interpolation. (using a cubic spline as is done when using Hermite interpolation is slower than when using Bilinear interpolation).

 

SIZE_BELL

[0x0007] Use bell interpolation to produce a high-quality image. This filter blurs the image at the same time it resizes. If you want performance similar to bicubic filtering but your source image is noisy, use this one.

 

SIZE_QUADRATIC_B_SPLINE

[0x0008] Use Quadratic B-Spline interpolation to produce a smooth quality image but one that is not as good as one produced using Cubic B-Spline interpolation. This is faster than SIZE_CUBIC_B_SPLINE.

 

SIZE_CUBIC_B_SPLINE

[0x0009] Use Cubic B-Spline interpolation to produce a very smooth quality image (very blurry). This is one step further than the 'Bell Filter'. This type of interpolation is a bit slower and generates an image with more blur but it has less noise. This method is faster than SIZE_BICUBIC.

 

SIZE_BOXFILTER

[0x00A] Use Box filter for results equivalent to Nearest Neighbor on Upsampling, and average pixels on Downsampling. This gives best result for images with single pixel lines.

 

SIZE_LANCZOS

[0x000B] Use Lanczos interpolation using Sinc (sinx/x) to produce a high-quality image. Provides the best quality but it is rather slow.

 

SIZE_MICHELL

[0x000C] Use Michel interpolation to produce a smooth quality image although not as smooth as one produced using Quadratic B-Spline interpolation. It is slower than SIZE_BICUBIC.

 

SIZE_COSINE

[0x000D] Use a Cosine function in the interpolation to produce a good quality image.

 

SIZE_CATROM

[0x000E] Use CatmullRom interpolation to produce a high-quality image. It is slower than SIZE_BICUBIC but faster than SIZE_LANCZOS.

 

SIZE_QUADRATIC

[0x000F] Use QUADRATIC interpolation to produce a high-quality image although it is not as good quality as one produced using Bilinear interpolation. It is slower than SIZE_BICUBIC.

 

SIZE_CUBIC_CONVOLUTION

[0x0010] Use Cubic Convolution interpolation to produce a high-quality image with enhanced image edges. It is slower than SIZE_BICUBIC.

 

SIZE_BILINEAR

[0x0011] Use Linear interpolation and averaging to produce a high-quality image. It is fast but slower than SIZE_NORMAL and SIZE_BRESENHAM

 

SIZE_BRESENHAM

[0x0012] Use Bresenham interpolation and averaging to produce a good quality image (better than SIZE_NORMAL). This is slower than SIZE_NORMAL but faster than SIZE_BILINEAR.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale and 48 and 64-bit color images is available in Document and Medical Imaging toolkits.

To see a visual comparison among these methods, showing speed and result of 500% enlargement, click  here.

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

Required DLLs and Libraries

LTIMGCOR

LTIMGUTL

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, Linux.

See Also

Functions:

L_ResizeBitmap, L_StartResize, L_Resize, L_StopResize,  L_DlgResize, L_ApplyTransformationParameters, L_GetMarksCenterMassBitmap, L_GetTransformationParameters, L_IsRegMarkBitmap, L_SearchRegMarksBitmap

Topics:

Raster Image Functions: Doing Geometric Transformations

Resizing Considerations

Processing an Image

Raster Image Functions: Document Imaging

Detecting Registration Marks

Raster Image Functions: Processing an Image

Example

//This example changes a bitmap to half its previous size

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName


 L_INT SizeBitmapInterpolatepExample(L_VOID)
{
   L_INT nRet;
   BITMAPHANDLE LeadBitmap;   /* Bitmap handle to hold the loaded image */

   /* Load the bitmap, at its own bits per pixel */
   nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\Image3.cmp")), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL);
   if(nRet != SUCCESS)
      return nRet;
   /* Change the size of the bitmap */
   nRet = L_SizeBitmapInterpolate(&LeadBitmap, LeadBitmap.Width / 2, LeadBitmap.Height / 2, SIZE_LANCZOS);
   if(nRet != SUCCESS)
      return nRet;

   nRet = L_SaveBitmap(MAKE_IMAGE_PATH(TEXT("Result.BMP")), &LeadBitmap, FILE_BMP, 24, 0, NULL);
   if(nRet != SUCCESS)
      return nRet;

   if(LeadBitmap.Flags.Allocated)
      L_FreeBitmap(&LeadBitmap);  
   return SUCCESS;
}
Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.