ImageEn, unit hyiedefs

TResampleFilter


Declaration

TResampleFilter = (rfNone, rfTriangle, rfHermite, rfBell, rfBSpline, rfLanczos3, rfMitchell, rfNearest, rfLinear, rfFastLinear, rfBilinear, rfBicubic, rfProjectBW, rfProjectWB, rfWICNearestNeighbor, rfWICLinear, rfWICCubic, rfWICFant, rfWICCubicHQ);


Description

Algorithms that improve the quality of the image when enlarging or shrinking (resizing the image or showing zoomed).

Filter Name Description Speed* B+W (ie1g) Gray-Scale (ie8g, ie16g) ie24RGB ie32RGB, ie48RGB
rfNone None No quality filtering is applied          
rfTriangle Triangle Produces good results for image reduction and enlargement, but displays sharp transition lines 193 ms         
rfHermite Hermite Uses a convolution kernel to interpolate the four nearest neighboring pixels 194 ms         
rfBell Bell Uses a convolution kernel to interpolate pixels. Bell attempts to compromise between reducing block artifacts and blurring the image, giving a soft image (useful for pictures containing noise) 205 ms         
rfBSpline B-Spline A basis spline which tends to create blurry images 207 ms         
rfLanczos3 Lanczos 3 A high-quality, processor-intensive filter that produces sharp images, but may introduce some ringing artifacts. Pixels are interpolated using a special curve simulating the real dissemination of information. Has a strong "self-sharpening effect" and is most useful when enlarging pictures. It can cause unaesthetic grid-like artifacts when shrinking due to the sharpening effect 234 ms         
rfMitchell Mitchell Produces smooth transitions when enlarging photo-realistic images. This filter is good compromise between the ringing effect of Lanczos and the blurring effect of other filters 211 ms         
rfNearest Nearest Neighbor The simplest and fastest native filter. It does not use interpolation, but evaluates each pixel based on their relative position in the source image (e.g. if enlarge an image by 2, one pixel will be enlarged to 2x2 area of the same color. If shrinking an image by 2, only 1 pixel of a 2x2 pixel block is retained). Works poorly with photos, but is useful for technical drawings with hairlines. Also called "Box" 182 ms         
rfLinear Linear A simple linear interpolation. Generally not recommended 192 ms         
rfFastLinear Fast Linear A fast algorithm that uses averages pixels when shrinking images and linear interpolation when enlarging. Provides the most "Bang-for-Buck," i.e. good quality output with excellent speed 35 ms          
rfBilinear Bilinear A simple interpolation that samples the closest 4 pixels surrounding the destination pixel. Fast and generally good when shrinking images 188 ms           
rfBicubic Bicubic A more advanced method that samples the 16 closest pixels, interpolating the values along a cubic curve. Produces good results with photos and complex or irregular images 185 ms           
rfProjectBW Project BW Quality filter for white on black background monochrome images           
rfProjectWB Project WB Quality filter for black on white background monochrome images           
rfWICNearestNeighbor Nearest Neighbor (WIC) Output pixel is assigned the value of the pixel that the point falls within. No other pixels are considered 8 ms           
rfWICLinear Bicubic (WIC) Output pixel values are computed as a weighted average of the nearest four pixels in a 2x2 grid 4 ms           
rfWICCubic Bilinear (WIC) Output pixel values are computed as a weighted average of the nearest sixteen pixels in a 4x4 grid 10 ms           
rfWICFant Fant (WIC) Output pixel values are computed as a weighted average of the all the pixels that map to the new pixel 21 ms           
rfWICCubicHQ High Quality Bicubic (WIC) A high-quality bicubic interpolation algorithm. Output pixel values are computed using a much denser sampling kernel than regular cubic. The kernel is resized in response to the scale factor, making it suitable for downscaling by factors greater than 2. Requires Windows 10 or newer! 110 ms           
* Example timings compared with rfNone when resampling a large image


Recommendations

For best quality: rfLanczos3, rfMitchell, rfBilinear, rfBicubic, rfWICCubicHQ
For speed: rfFastLinear, rfWICCubic, rfWICFant
For Monochrome images: rfProjectBW, rfProjectWB

You can view the effect of the various filters in the demo:
Demos\Display\ZoomFilter\ZoomFilter.dpr


Sample Comparison

Filter Upscale a 165x100 image to 300% Downscale a 2400x1500 image to 20%
rfNone
rfTriangle
rfHermite
rfBell
rfBSpline
rfLanczos3
rfMitchell
rfNearest
rfLinear
rfFastLinear
rfBilinear
rfBicubic
rfWICNearestNeighbor
rfWICLinear
rfWICCubic
rfWICFant
rfWICCubicHQ


See Also

IEResampleFilterToStr