user198729 user198729 - 11 months ago 79
C Question

How to process jpg images with c/c++ most easily?

I want to iterate over each pixel color in a

format image,

which library should I refer to to do this so that the code can be as short as possible?

Answer Source

I can think of either ImageMagick or CImg. Here is a CImg tutorial for you. They abstract away a lot of the decompression details and just give you a grid to work with.

If you go with CImg, you only need to use the data call. You can probably do something like:

CImg<unsigned char> src("image.jpg");
int width = src.width();
int height = src.height();
unsigned char* ptr =,10); // get pointer to pixel @ 10,10
unsigned char pixel = *ptr;