00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <it/io.h>
00023 #include <it/mat.h>
00024
00025 int main ()
00026 {
00027 const char *filename_in = "../data/test.pgm";
00028 const char *filename_out = "out.pgm";
00029 char pnm_type, comments[1000];
00030 int width, height, maxval;
00031 imat m;
00032
00033 pnm_info (filename_in, &pnm_type, &width, &height, &maxval, comments, 1000);
00034 printf ("file name = %s\npnm type = %c\n%dx%d -> maxval=%d\ncomments=%s\n",
00035 filename_in, pnm_type, width, height, maxval, "");
00036
00037 m = imat_pgm_read (filename_in);
00038
00039 printf
00040 ("height(m) = %d\tmaxheight(m) = %d\nwidth(m) = %d\tmaxwidth(m) = %d\n",
00041 imat_height (m), imat_height_max (m), imat_width (m),
00042 imat_width_max (m));
00043
00044 imat_pgm_write (filename_out, m);
00045 imat_delete (m);
00046 return 0;
00047 }