read a grayscale bitmap in C++

A

Anirudh Saria

Does anyone know how to read in a grayscale bitmap image in Visual C++ and
store the pixel values in an array ?

Thanks,
Anirudh
 
V

Victor Bazarov

Anirudh Saria said:
Does anyone know how to read in a grayscale bitmap image in Visual C++ and
store the pixel values in an array ?

Sure. You open the file using 'ifstream' object, and then use
'read' member function to retrieve the contents of the file.
Whenever you encounter a "pixel value" (whatever that means
to you), you store it in the array you allocate before starting
the reading operation. Use 'new' to allocate the array.

Or did you expect to find a manual of graphical file formats
here? We don't do graphics in comp.lang.c++. You should try
comp.graphics.algorithms or comp.os.ms-windows.programmer.

Victor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top