Program 3: Alter Image
Summary | Instructions
| PPM Format |
PGM Format |
Submission Instructions
Read in a PPM file and modify it in an interesting way.
- Write a program in C to read a PPM file specified on the command line
argv[2],
perform the operation specified in argv[1] and
output it to standard out with some sort of interesting modification.
- Use
strcmp on argv[1] to determine which function to call for
conversion.
- Use fread to read in the image's binary data without a loop.
- Organize your work with several functions. Start with the first.
- View the output with an image viewer.
- Sample input files: P3 file,
P6 file, P6
file, for full credit read in P3 (optionally P6) with
comments.
|
Grade
|
Program Name
|
Description
(click samples to see one implementation - yours may
differ) |
Command-line Arguments
|
|
80%
|
p3.c
|
Add black TV scan lines
simpleLines.png |
-sL inputFile |
|
85%
|
p3.c |
Blend in black TV scan lines
lines.png |
-bL
inputFile |
|
90%
|
p3.c |
Flip an image vertically
|
-fV
inputFile |
|
95%
|
p3.c |
Flip an image horizontally |
-fH
inputFile |
|
110%
|
p3.c |
Rotate an image 90 degrees
|
-r90
inputFile |
Style
- Use as many functions as is reasonable outside of your main
function to make your program more reusable. Header files will
simplify here.
- Use either 3 or 4 spaces for each indentation. Be consistent. Pick a number and
stay with it.
- Do not use tabs to indent because the printer does not have the
same tab spacing as the computer. Use the space bar to indent.
- Put every C statement a separate line.
- (Optional) If the condition for execution, such as in a while or if statement can be
written in the form "( constant == var )" it may not be written in the form "(
var == constant )".
- Comments must be included when they will aid the reader in understanding the
program. Do not comment the obvious. Comment
what
you are doing, not
how.
- Variable names are to be lower case. Constants are to be in all capital letters.
- Use meaningful variable names. Long names are better than unclear names.
- Do not use the single letter 'o' or the single
letter 'l' for variable names.
- Use white space to set off logical ideas. Comment logical blocks.
Your grade is determined by the difficulty of the image effect.
Do start with the simplest. In this manner all your work can be viewed
but only the most difficult image effect needs to be graded for your
final grade on this assignment.- Turn this assignment in a full 24 hours early (to the minute) to
receive an extra 5 points.
- Your C program file should be named appropriately for the effect you chose.
- Hand in program no later than 11:59 p.m. Friday, October 31st.
- Email
p3.c as an attachment to your lab professor. Paste into the subject
line CSC 112 Program 3
-
source code attachments
-
subject line:
CSC 112 Program 3
-
a brief summary of what your program will or will not do,
i.e. reads P3 and P6 with comments, performs -sL, -sB, -fH, -fV, and -r90
conversions.
- Keep the email submission confirmation for reference later.
Summary | Instructions
| PPM Format |
PGM Format |
Submission Instructions
|