-
Notifications
You must be signed in to change notification settings - Fork 0
/
image.h
37 lines (27 loc) · 1.1 KB
/
image.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef STEGANOGRAPH_IMAGE_H
#define STEGANOGRAPH_IMAGE_H
typedef struct _imagePGM {
char magic[3]; // magic identifier, "P2" for PGM
int width; // number of columns
int height; // number of rows
int max_value; // maximum grayscale intensity
int **pixels; // the actual grayscale pixel data, a 2D array
} ImagePGM;
// Given a filename of a pgm image, read in the image and
// store it in the ImagePGM structure. Return the address of
// the ImagePGM structure if the file can be opened or
// NULL otherwise.
ImagePGM *readPGM(char *filename);
// Write out a pgm image stored in a ImagePGM structure into
// the specified file. Return 1 if the file can be opened or
// 0 otherwise.
int writePGM(ImagePGM *pImagePGM, char *filename);
// Encode/embed a message into a PGM image.
// Return 0 if the image is too small or
// 1 otherwise.
int encode(ImagePGM *pImagePGM, char *msg);
// Decode/extract and return the message embedded in a PGM image
char *decode(ImagePGM *pImagePGM);
// Free the space used by a pgm image.
void freePGM(ImagePGM *pImagePGM);
#endif //STEGANOGRAPH_IMAGE_H