BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Resize a BMP, JPEG, GIF

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics)
View previous topic :: View next topic  
Author Message
Antonio Farfan
Guest





PostPosted: Wed Jul 09, 2003 10:50 am    Post subject: Resize a BMP, JPEG, GIF Reply with quote



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





PostPosted: Wed Jul 09, 2003 12:56 pm    Post subject: R: Resize a BMP, JPEG, GIF Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.