ImageEn, unit imageenproc

TImageEnProc.Resample

TImageEnProc.Resample


Declaration

procedure Resample(NewWidth, NewHeight: Integer; FilterType: TResampleFilter = rfNone; MaintainAspectRatio: Boolean = False); overload;
procedure Resample(ScaleBy: Double; FilterType: TResampleFilter = rfNone); overload;


Description

Resizes the current image. Unlike ImageResize, the content of the image will change (i.e. it is stretched to the new size).

Parameter Description
NewWidth New image width in pixels. If NewWidth is -1 then it is calculated automatically, respecting the proportions
NewHeight New image height in pixels. If NewHeight is -1 then it is calculated automatically, respecting the proportions
FilterType Resampling interpolation algorithm
MaintainAspectRatio Automatically reduces NewWidth or NewHeight to ensure the original proportions of the image are maintained

Supported filters by PixelFormat:
Filter ie1g ie8g ie16g ie24RGB ie32RGB ie48RGB
rfNone                  
rfTriangle                  
rfHermite                  
rfBell                  
rfBSpline                  
rfLanczos3                  
rfMitchell                  
rfNearest                  
rfLinear                  
rfFastLinear                  
rfBilinear                  
rfBicubic                  
rfProjectBW                  
rfProjectWB                  
rfWICNearestNeighbor                  
rfWICLinear                  
rfWICCubic                  
rfWICFant                  
rfWICCubicHQ                  

Note: A UI for this is available to your users in the Image Processing dialog


Demo

Demo  Demos\ImageEditing\EveryMethod\EveryMethod.dpr


Examples

// Resize the image to width of 50 (with height automatically set) without any smoothing algorithm
ImageEnView1.Proc.Resample( 50, -1, rfNone );

// Resize the image to height of 100 (with width automatically calculated) and high quality smoothing
ImageEnView1.Proc.Resample( -1, 100, rfLanczos3 );

// Resize the image so that it is no higher or wider than 100, but maintains the original aspect ratio (e.g. a 4:3 portrait image would have the new dimensions 100 x 75)
ImageEnView1.Proc.Resample( 100, 100, rfLanczos3, True );

// Resize the image to half its current size with fast, but good quality smoothing
ImageEnView1.IO.LoadFromFile( 'D:\TestImage.jpg' );




ImageEnView1.Proc.Resample( 0.5, rfLanczos3 );




See Also

 ResampleTo