I do not know if it has already been discussed and if so I apologize but, to resize some jpeg images I am using the following code but it is very slow: what is the reason?
Thank you
Code: Select all
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Graphics::TBitmap *bmp1 = new Graphics::TBitmap;
Graphics::TBitmap *bmp2 = new Graphics::TBitmap;
TJPEGImage *jpeg = new TJPEGImage;
jpeg->LoadFromFile("test.jpg");
bmp1->Width=jpeg->Width;
bmp1->Height=jpeg->Height;
bmp1->Assign(jpeg);
TRect ARect;
bmp2->Width=120;
bmp2->Height=120;
ARect=::Rect(0, 0, bmp2->Width, bmp2->Height);
bmp2->Canvas->StretchDraw(ARect,bmp1);
Image1->Picture->Bitmap->Assign(bmp2);
delete bmp1;
delete bmp2;
delete jpeg;
}