> I have a question concerning the formats of the ppm and ppg files. I > clearly understand the header portion of each file, but have a few questions > concerning the body of these files. In class you told us that these files > would be in ASCII format. The file paw.ppm that you have on your website is > apparently either binary data or some other form that I am not familiar with > (I can view the picture but not the source code behind it when opening the > file in a program such as notepad). Should we expect decimal numbers for > the RGB components in the body (0 to 255) or should we expect binary > components (00000000 to 11111111)? Also, are the RGB components delimited > in any way? > > Also, please comment on the same 2 scenarios applicable to the ppg file's > body (G G G G or GGGGG). In class, I stated that the files would be in binary, not ASCII. That means you can't read them with a standard text editor and if you try to list them, you'll get unreadable output, such as beeps and strange characters. The header portion of these files are also in binary format, though since they are comprised of ASCII characters, you can see the header data with an ASCII editor/viewer. Also, recall in class we went over exactly how to read the RGB components in the files: scanf ("%c%c%c", &R, &G, &B); This statement implies that the data is in binary format (each byte-length component stored in an unsigned char) with no space delimiters, either between components or sets of components. The same holds for grayscale pgm files. -------------------------------------------------------------------------- > I have a question regarding style requirements for our program. I noticed > that you did not have any up on your website. Is their anything required > for our program.. Granted I know we should have a headed, but do we need to > put comments everywhere(will you take off points), do we need certain > spacing etc. Thanks so much! As noted on the syllabus, you can find the program style guidelines by following the link on the lab webpage. -------------------------------------------------------------------------- > What files do you want handed-in? Just the IMG.C file? Yes. Please submit the program only (no image files). If you need to communicate some additional information to the grader concerning your program (compiling instructions, etc.), you may also include a readme.txt file. -------------------------------------------------------------------------- > I was about to write the error messages for when the program should exit > -- right after you test for a 'P' or a '5' for grayscale. And then I got > to thinking, the sheet you gave us said that for grayscale, our program > should read in a COLOR image, and CONVERT it to grayscale. So I guess I'm > confused... Why would we be testing to make sure the file being read-in is > grayscale if it's supposed to be color? Shouldn't we be testing to see if > it's '6' instead of '5', since we're going to write the output to 'P5'? For each part of the program, you need to check the image type to make sure it's appropriate. For conversion to grayscale, the appropriate image type is "P6" (as you stated above). For dither, the appropriate image type is "P5". The correct image type therefore depends solely on the task you're performing. --------------------------------------------------------------------------