Is there any in built function by which one can directly read or access image files?
http://nnhamane.googlepages.com/
Printable View
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).
--
Mats
images == complicated things at first
You should understand their headers and algorithm to parse them.
Using image libraries will be very helpful.
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.
The RFCs (if they exist) for the image formats or other documentation... you have a LONG road ahead of you if you plan to write it all yourself.
Google is a good website to start.
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.
If you search, you may find the BMP display mode that was worked on and posted here on the forum, some months back.