views:

742

answers:

6

Hi, I want to extract some kind of bmp/rgb data from jpeg files.

I had a look at libjpeg, but there seemed not to be any good documentation available. So my questions are:

  1. Where is documentation on libjpeg?
  2. Can you suggest other c-based jpeg-decompression libraries?

thanks in regard

ps: I am using GNU/Linux, and c/c++

+2  A: 

MagickWand is the C API for ImageMagick:

http://imagemagick.org/script/magick-wand.php

I have not used it, but the documentation looks quite extensive.

balpha
+2  A: 

You should check out Qt's QImage. It has a pretty easy interface that makes this task really easy. Setup is pretty simple for every platform.

If Qt is overkill, you can try Magick++ http://www.imagemagick.org/Magick++/. It supports similar operations and is also well suited for that sort of task. The last time I used it, I struggled a bit with dependencies for it on Windows, but don't recall much trouble on Linux.

For Magick++'s Image class, the function you probably want is getConstPixels.

Ben Hughes
Mh didn't want to use Qt this time ;) (working with it for 5 years, gotta try something else) thanks for the hint, anyways
Ronny
+4  A: 

The documentation for libjpeg comes with the source-code. Since you haven't found it yet:

Download the source-code archive and open the file libjpeg.doc. It's a plain ASCII file, not a word document, so better open it in notepad or another ASCII editor.

There are some other .doc files as well. Most of them aren't that interesting though.

Unfortunately I cannot recommend any other library besides libjpeg. I tried a couple of alternatives, but Libjpeg always won. Is pretty easy to work with once you have the basics done. Also it's the most complete and most stable jpeg library out there.

Nils Pipenbrinck
starting wine just for notepad sounds funny :)
quinmars
The source kit also includes sample code for both encode and decode of image data.
RBerteig
The other documents have information that is critical if you are porting libjpeg to another platform, such as an embedded system. They are probably worth skimming once, but won't be very helpful to a client of libjpeg.so.
RBerteig
I see. I downloaded the source, but must have missed that file.
Ronny
+1  A: 
KPexEA
+1  A: 

A slightly out of the box solution is to acquire a copy of the netpbm tools, which transform images from pretty much any format to any other format via one of several very simple intermediate formats. They work well from the shell, and are most often used in pipes to read some arbitrary image, perform an operation on it, and write it out to some other format.

The pbm formats can be as simple as a plain ASCII header followed by the RGB data in ASCII or binary. They are intended to be simple enough to use without required a library to implement.

JPEG is supported in netpbm by read and write filters that are implemented on top of libjpeg.

RBerteig
A: 

Hi! I have extracted data from .bmp file and saved it in a .txt file. Now I want to convert it to the .bmp file. Would you please tell me how can I do it? -Babu

Md. Aktaruzzaman
I recommend making a new question. And please be more precise. e.g. what's your intention. development environment. how did you extract data from a bmp. what data exactly. what data do you want to write back. I wouldn't know how to help you with your question.
Ronny