Solved

JPEG to BMP or JPEG to matrix

Posted on 2001-07-17
10
1,136 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
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…
Learn how to download your full Prezi presentation for offline presenting. Prezi doesn’t have to be viewed and shared in a web browser, even with a free account you can download your full presentation to share with others. Be sure to download any vi…
Learn how to use the remote presentation tool in Prezi to allow you to harness the power of this cloud based presentation platform. You can show your presentation with a remote audience using this free tool.

756 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