Solved

JPEG to BMP or JPEG to matrix

Posted on 2001-07-17
10
1,146 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
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
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. …
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.
Learn the basics of inputting and editing your text components in Prezi. We will cover how to set styles, position, and group your text components. In your Prezi editor, click anywhere on the canvas to add text: A flashing cursor informs you that yo…
Suggested Courses

628 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