Available in LEADTOOLS Imaging Pro, Vector, Document, and Medical Imaging toolkits. |
LBitmapBase::SizeInterpolate
#include "ltwrappr.h"
L_INT LBitmapBase::SizeInterpolate(nWidth, nHeight, uFlag = SIZE_NORMAL)
L_INT nWidth; |
/* new width in pixels */ |
L_INT nHeight; |
/* new height in pixels */ |
L_INT uFlag; |
/* quality control flags */ |
Resizes a bitmap to a new width and height.
Parameter |
Description |
|
nWidth |
Value that represents the new width, in pixels. |
|
nHeight |
Value that represents the new height, in pixels. |
|
uFlag |
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_BICUBIC but slower 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_QUDRATIC |
[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 only in the Document/Medical toolkits.
To see a visual comparison among these methods, showing speed and result of 500% enlargement, click here.
Required DLLs and Libraries
LTIMGCOR For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
See Also
Functions: |
LBitmapBase::Size, LBuffer::StartResize, LBuffer::Resize, LBuffer::StopResize, Class Members. |
Topics: |
|
|
Example
L_INT LBitmapBase__SizeInterpolateExample() { L_INT nRet; LBitmapBase MyBitmap; nRet =MyBitmap.Load(TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\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; }