PLEASE USE NEW CODE
In this assignment, you are asked to manipulate an image from a24-bit uncompressed bmp file. (The format of bmp files is given inhttp://en.wikipedia.org/wiki/BMP_file_format). To help with readingand writing the image file, you are given library functions and anexample that deal with the bmp file (in a zip file). In theexample, the image is flipped horizontally. You are asked toimplement some additional functions including the verticalflip(),enlarge() and rotate() functions: the first flips the imagevertically, the second is used to enlarge the image by an integerscale factor of 2 or 3; the last one is used to rotate the imageeither clockwise by 90 degrees or counter-clockwise by 90degrees.
The program should take the follow command-line options:
Where -s means to scale the image by a scale factor of 2 or 3 asindicated on the command line with a 2 or a 3, -r means to rotatethe image by 90 degrees clockwise, -l means to rotate the image by90 degrees counter-clockwise, -v means to flip the image verticallyand -f means to flip the image horizontally. You can assume foreach type (-s, -r, - l, -f, or -v), the command line has at mostone option, but that should not affect your code. Only implementeach one one time no matter how many times it is included. However,the user may present a combination, say, 'bmptool -r -s -l -f -v'.If multiple option types are present, the order for processing theimage is that you do scale first, then any rotate options, and thenflip vertically and finally flip horizontally.
You are required to use getopt() to process the command-line. If'-o output_file' is missing, use standard output. If 'input_file'is missing, use standard input. The options to use standard inputor standard output will only be used when chaining commands. Makesure the program returns 0 on success. In that case, one can'chain' the commands using pipes, like:
Your program needs to provide necessary sanity-check for commandline arguments and handle various error conditions and prompt theuser with helpful information. You need to use getopt() to processthe command line arguments. Test your program with variouscombinations to make sure it works as expected. You must usedynamic memory to store the content of the new image before writingout to file. You need to reclaim memory afterwards to preventmemory leaks. Please submit your work through Canvas as one zipfile called FirstnameLastnameA2.zip. Follow the instructions belowcarefully (to avoid unnecessary loss of grade). Include your sourcecode, your Makefile, the bmplib files that I have provided, and theexample.bmp file in the zip file. I should be able to create theexecutable by typing ‘make’. The Makefile should also contain a'clean' target for cleaning up the directory (removing all objectfiles). Make sure you don't include intermediate files: *.o,executables, *~, etc., in your submission. (There'll be a penaltyfor including unnecessary intermediate files).
Use C Language
PLEASE USE NEW CODE In this assignment, you are asked to manipulate an image from a 24-bit uncompressed bmp file. (The f
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am