Version 4.3.0 has a new unit called iexhelperfunctions.pas. One of the new functions is Bitmap.IEConvertToThumbnail. It is very fast and works well:
procedure TForm1.IEConvertToThumbnail1Click(Sender: TObject);
{ Convert TBitmap to the specified size with or without a border or a shadow. }
var
iMaxX: Integer;
iMaxY: Integer;
iCanStretch: boolean;
iQualityFilter: TResampleFilter;
iAddBorder: boolean;
iBorderColor: TColor;
iAddShadow: boolean;
iBlurRadius: Integer;
iShadowOffset: Integer;
iShadowColor: TColor;
iBackgroundColor: TColor;
begin
ImageEnView1.Proc.SaveUndo();
Undo1.Enabled := ImageEnView1.Proc.CanUndo;
iMaxX := StrToIntDef(Width1.Text, 320);
iMaxY := StrToIntDef(Height1.Text, 240);
iCanStretch := CanStretch1.Checked;
iQualityFilter := TResampleFilter(ResampleFilter1.ItemIndex);
iAddBorder := AddBorder1.Checked;
iBorderColor := BorderColor1.Selected;
iAddShadow := AddShadow1.Checked;
iBlurRadius := StrToIntDef(BlurRadius1.Text, 4);
iShadowOffset := StrToIntDef(ShadowOffset1.Text, 4);
iShadowColor := ShadowColor1.Selected;
iBackgroundColor := ThumbnailBackgroundColor1.Selected;
ImageEnView1.Bitmap.IEConvertToThumbnail(iMaxX, iMaxY, iCanStretch, iQualityFilter, iAddBorder,
iBorderColor,
iAddShadow, iBlurRadius, iShadowOffset, iShadowColor, iBackgroundColor);
ImageEnView1.Update;
StatusBar1.Panels[2].Text := 'Width: ' + IntegerToString(ImageEnView1.Bitmap.Width);
StatusBar1.Panels[3].Text := 'Height: ' + IntegerToString(ImageEnView1.Bitmap.Height);
end;
My EBook will have a new chapter in it that shows how to use all the iexHelperFunctions.
William Miller
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html