We help IT Professionals succeed at work.
Get Started

Load and store *.pnm image file

241 Views
Last Modified: 2016-01-31
I would like to write two functions to load and store binary (types P5 and P6) “*.pnm” image files but I am new in image processing, can anyone help me or give me some resources that I can use. Furthermore, The image structure should contain following:
type : an integer value specifying the image type. Values Gray = 0 and RGB = 1
width : an integer value specifying the width of the image.
height : an integer value specifying the width of the image.
data : a byte array of image data (stored in row major order).

For example following C++ code shows the headers of required functions.

struct Image {
int type; // an integer value specifying the image type. Values // Gray = 0 and RGB = 1 
int width; // an integer value specifying the width of the image.
int height; // an integer value specifying the height of the image. 
char* data; // an 8-bit array of image data (row major).
 }; 

Image loadImage(string fileName); 
void storeImage(string fileName, Image img);

Open in new window

Comment
Watch Question
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE