I am trying to open a .ras image in GIMP that was created in my program. I am able to open the file and view it in Photoshop as a .raw file, but the teacher requires that the grader/teacher view the file in GIMP. (go figure)
The error message I get is " Can't open file as SUN raster file"
I'm not sure what is causing the error.
Here is the code that saves the file. Any hints would be appreciated.
The "new image" is the same as the old when I open it in Photoshop, so I'm pretty sure its saving it. But I don't know how to force a format that GIMP can read.Code:ofstream is2; is2.open("newimage.ras", ios:: out); //the extra space was to eliminate :o struct rasterfile header; header.ras_height=Image::GetRow(); header.ras_width=Image::GetCol(); size = header.ras_width*header.ras_height; for(i=0; i<size;i++) { img[i]; } is2.write(reinterpret_cast<char *>(&header),sizeof(struct rasterfile)); is2.write(colormap, 256*3); is2.write(img, size); cout << "Size: " << sizeof(size); //prints out 4 cout<< "header: " << sizeof(struct rasterfile); //prints out 32 is2.close();
Any help would be greatly appreciated. Thanks in advance
Sandy



LinkBack URL
About LinkBacks


