Bmp out of smallbmp by resizing the latter by a factor

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: INFOHEADER specifies the BMP’s color depth (i.e., bits per pixel)? Why might fopen return NULL in copy.c:32? Why is the third argument to fread always 1 in our code? What value does copy.c:69 assign padding if bi.biWidth is 3? What does fseek do? What is SEEK_CUR? Okay, back to Mr. Boddy. Write a program called whodunit in a file called whodunit.c that reveals Mr. Boddy’s final words. OMG, what? How? Well, think back to childhood when you held that piece of red plastic over similarly hidden messages.13 Essentially, the plastic turned everything red but somehow revealed those messages. Implement that same idea in whodunit. Like copy, your program should accept exactly two command ­line arguments. And if you execute a command like the below, stored in verdict.bmp should be a BMP in which Mr. Boddy’s message is actually legible. 11 Assume a 32 ­bit architecture like cloud.cs50.net. Leading bytes used to identify file formats (with high probability) are generally called “magic numbers.” 13 If you remember no such piece of plastic, best to ask a friend or TF about his or her childhood. 12 10 < 16 This is CS50. Harvard College Fall 2010 whodunit clue.bmp verdict.bmp Allow us to suggest that you begin tackling this mystery by executing the command below. cp copy.c whodunit.c Wink wink. You may be amazed by how few lines of code you actually need to write in order to help Mr. Boddy. There’s nothing hidden in smiley.bmp, but feel free to test your program out on its pixels nonetheless, if only because that BMP is small and you can thus compare it and your own program’s output with xxd during development.14 Rest assured that more than one solution is possible. So long as your program’s output is readable (by your teaching fellow), no matter its color(s), Mr. Boddy will rest in peace. In ~/pset5/questions.txt, answer the question below. 18. Whodunit? And where? And with what? Well that was fun. Bit late for Mr. Boddy, though. Let’s have you write more than, what, two lines of code? Implement now in resize.c a program called resize that resizes 24 ­bit uncompressed BMPs by a factor of n. Your program should accept exactly three command ­line arguments, per the below usage, whereby the first (n) must be a positive integer less than or equal to 100, the second the name of the file to be resized, and the third the name of the resized version to be written. Usage: resize n infile outfile...
View Full Document

Ask a homework question - tutors are online