
/*
** Program to illustrate use of DFR8getdims and DFR8getimage 
**
** Files needed:  old.hdf (look in "files" directory)
** Files created: new.hdf
*/

#define HEIGHT 150
#define WIDTH  200
main()
{
    int DFR8getdims(), DFR8getimage(), DFR8putimage();
    int ispal, ret, width, height;
    char image[HEIGHT][WIDTH], pal[768];

/************* read in image *****************/
    DFR8getdims("old.hdf", &width, &height, &ispal);
    if ( (width==WIDTH) && (HEIGHT==150) ) {
       ret = DFR8getimage("old.hdf",image,width,height,pal);
       printf("ret=%d\n",ret);
    } else {
       printf("width=%d   height=%d\n",width, height);
       printf("Wrong dimensions.  Program aborted.");
       exit(1);
    }

/****** write same image to different file ***********/
    DFR8addimage("new.hdf", image, width, height, ispal);

}
