Solved

JPEG to BMP or JPEG to matrix

Posted on 2001-07-17
10
1,114 Views
Last Modified: 2013-11-19
Hi experts,
i would like to develop a personal picture viewer. So i need to read JPEG format from disk file and use it as a table of RGB components with the correct size. I will use Borland C++ 5.
Does anyone have a source code for reading the JPEG format and placing it in a matrix? Or converting JPEG to BMP in a buffer because the BMP treatment is embedded in the picture object of C++.
Thanx.
Arnaud.
0
Comment
Question by:arno_webmaster
10 Comments
 

Expert Comment

by:Yunoshev
ID: 6289771
TJPEGImage in Delphi, may be CJPEGImage in Builder???
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 6290569
Next code display jpeg  as Bitmap in TImage component.
After that you can save it(if need).

void __fastcall TMyForm::bnOpenClick( TObject * Sender )
{
// load file
if ( dlgOpen->Execute( ) )
{
// load JPEG
std::auto_ptr< TjpegImage > theJPEG( new TjpegImage ) ;
theJPEG->LoadFromFile( dlgOpen->FileName ) ;

// copy to bitmap
std::auto_ptr< Graphics::TBitmap > theMap( new
Graphics::TBitmap ) ;
theMap->Assign( theJPEG.get( ) ) ;

// show bitmap
MyImage->Picture->Assign( theMap.get( ) ) ;
} // if...
}

0
 
LVL 2

Expert Comment

by:jonnin
ID: 6291364
I was able to hack the tga writer in the standard jpg lib to create raw images (rgb array) if you still need that.  All you  have to do is strip off the lines that write the header, very easy...
0
 
LVL 1

Author Comment

by:arno_webmaster
ID: 6293532
I found the answer by myself. In www.borland.com there is a section where it is possible to download a Tjpeg component for Borland 3. With the fils is provided an example.
0
 
LVL 1

Author Comment

by:arno_webmaster
ID: 6293539
I found the answer at www.borland.com but it was not easy at first sight.
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 6304568
aron_..., do you try use my code?
0
 
LVL 2

Expert Comment

by:gysbert1
ID: 6307905
Yunoshev told you about the component ...

After that AlexVirochovsky  gave you code showing how to use it.

I think you owe at least one of them the points !
0
 
LVL 1

Author Comment

by:arno_webmaster
ID: 6308212
As i said, i have found the answer on www.borland.com. So i did not try the code. I have not much time for the moment but will check it later.
0
 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 200 total points
ID: 6422266
arno, if you don't use my code (or code from borland , that ~ same ), you can reject my reply.
Alex
0
 
LVL 1

Author Comment

by:arno_webmaster
ID: 6422791
I don't use your code so i cannot give more than C, but i'll give you the points to close the question.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Many programs have tried to outwit PowerPoint in terms of technology and skill. These programs, however, still lack several characteristics that PowerPoint has possessed from the start. Here's why PowerPoint replacements won't entirely work for desi…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
In addition to being a great web-based presentation tool, Prezi also makes it easy to save your presentation as a PDF to share with others as well. Learn how in this tutorial. Select the share icon from the top menu in your Prezi editor: Select "D…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now