Solved

JPEG to BMP or JPEG to matrix

Posted on 2001-07-17
10
1,127 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Vector Icons 2 94
VS2015 compilation and missing DLLs 9 147
Corel Draw -- open source replacement ? 8 112
c++ reading data from file into two dimensional array 3 107
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Learn how to set up basic frames and paths in Prezi and understand the open space that Prezi allows you to create presentations in.

785 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