 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Antonio Farfan Guest
|
Posted: Wed Jul 09, 2003 10:50 am Post subject: Resize a BMP, JPEG, GIF |
|
|
Are there any function to resize (reduce for example a image) an image from
the code?
Thanks very much.
|
|
| Back to top |
|
 |
Steve_Aletto Guest
|
Posted: Wed Jul 09, 2003 12:56 pm Post subject: R: Resize a BMP, JPEG, GIF |
|
|
Antonio Farfan <amfm0777 (AT) hotmail (DOT) com> wrote in message
[email]3f0bf260 (AT) newsgroups (DOT) borland.com[/email]...
| Quote: | Are there any function to resize (reduce for example a
image) an image from
the code?
|
Among all the solutions, you could use StretchDraw method of
TCanvas. Here is an easy and fast written approach:
TImage *MyImage1 = new TImage(this);
TImage *MyImage2 = new TImage(this);
MyImage1->AutoSize = true;
MyImage1->Picture->LoadFromFile("c:\test.bmp");
MyImage2->Width = MyImage1->Width / 2;
MyImage2->Height = MyImage1->Height / 2;
MyImage2->Canvas->StretchDraw(Rect(0, 0,
MyImage2->Width, MyImage2->Height),
MyImage1->Picture->Graphic);
MyImage2->Picture->Bitmap->SaveToFile("c:\test_resized.bmp"
);
delete MyImage1;
delete MyImage2;
It works with bitmaps, but it can easily be adapted for
jpegs. GIF isn't natively supported by BCB.
HTH,
Steve.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|