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 

Save as JPG

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





PostPosted: Fri Apr 29, 2005 3:33 pm    Post subject: Save as JPG Reply with quote



Hi All

I'm pretty new to c programming, and have a little question.
I'm writing a web-cam application (it's a very long story, but my 'normal'
web-cam software will not work with my capture card).
I have a timer running which will grab a single frame, and then FTP it to my
web-site. This works reliably, but I'm using capFileSaveDIB which produces a
bmp file. Is there an easy way to convert to (or save as) a jpg ?
TIA


Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Fri Apr 29, 2005 6:18 pm    Post subject: Re: Save as JPG Reply with quote




"Grumps" <grumpsnothere (AT) hotmail (DOT) com> wrote


Quote:
Is there an easy way to convert to (or save as) a jpg ?

Load the DIB into a TBitmap and then Assign() it to a TJPEGImage. For
example:

if( capFileSaveDIB(hCapWnd, "c:\folder\file.bmp") )
{
Graphics::TBitmap *bmp = new Graphics::TBitmap;
try
{
bmp->LoadFromFile("c:\folder\file.bmp");
TJPEGImage *jpg = new TJPEGImage;
try
{
jpg->Assign(bmp);
jpg->SaveToFile("c:\folder\file.jpg");
}
__finally {
delete jpg;
}
}
__finally {
delete bmp;
}
}


Gambit



Back to top
Grumps
Guest





PostPosted: Fri Apr 29, 2005 6:43 pm    Post subject: Re: Save as JPG Reply with quote



"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> wrote

Quote:

"Grumps" <grumpsnothere (AT) hotmail (DOT) com> wrote in message
news:42725416 (AT) newsgroups (DOT) borland.com...

Is there an easy way to convert to (or save as) a jpg ?

Load the DIB into a TBitmap and then Assign() it to a TJPEGImage. For
example:

if( capFileSaveDIB(hCapWnd, "c:\folder\file.bmp") )
{
Graphics::TBitmap *bmp = new Graphics::TBitmap;
try
{
bmp->LoadFromFile("c:\folder\file.bmp");
TJPEGImage *jpg = new TJPEGImage;
try
{
jpg->Assign(bmp);
jpg->SaveToFile("c:\folder\file.jpg");
}
__finally {
delete jpg;
}
}
__finally {
delete bmp;
}
}

Thanks.
Just what I needed.



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.