How can i read .bmp, .jpeg image in C language?

This is a discussion on How can i read .bmp, .jpeg image in C language? within the C Programming forums, part of the General Programming Boards category; Is there any in built function by which one can directly read or access image files?
http://nnhamane.googlepages.com/...

Depends on what you mean by "access" - fopen("myimage.jpg", "rb") would open a jpg in binary form. But if "access" means that you can actually get to the pixels in a x,y format, then that's quite far from what you need, since JPG (and BMP to a lesser extent) are not just an array of pixels, but contains meta-data and in the JPG case is compressed in such a way that you would process the input quite a bit to get it into an array of pixels.

There are image libraries (jpeglib for example) that can work with images.

Windows also has functions that allow you to load images as bitmaps (JPEG, BMP, TIFF, PNG, etc), and further functions to use those bitmaps for various purposes (as a source or destination of drawing functions, for example).

Hi matsp & audinue,
Thankx for your reply.
Actually i want to read each pixel of image, it may be of any type. For exa take .ppm image file, which contains less information. But i don`t know the exact structure of header or pixel. I am interested in C/C++ only. Plz tell me something about how to open image headers or pixels in C/C++? or tell me any sitename where i can found all information.

libjpeg is a fine choice for reading JPEGs, as for BMP I can't think of any portable library as I mostly use it with Windows API. Finding something to care of BMPs shouldn't be hard as it is a really simple format, pretty much a pixel array with a header. You could probably write one yourself with a bit of research.