how to read .raw image file in C++
Posted on 2007-12-02
I am trying to open a .raw image file stored on my hard drive in a C++ program to manipulate it.
After opening the file, want to save its pixel information in a 2-D array. The image is a 256 X 256 with 8 bits per pixel and no header bytes.
I would like the array to be dynamic so that i am not limited to only a 256 X 256 image, but the 8-bit representation will be unchanged.
I figured using fstream in binary mode would work, but it doesn't seem too or maybe i am using it wrong.
Can someone please show me how I can open the .raw file and then load it into a dynamic array and the needed libraries.
If it makes any difference, I am using a window xp machine running Visual Studio .Net 2005 as my c++ editor and compiler
Thank you so much