Write a program to mirror a bitmap file (flip horizontally). We assume that the bitmap file follows the following format. We also assume that each pixel has three bytes.
In this problem you need to mirror a bitmap file and output the result as "mirrored.bmp". The filename of the bmp file will be given as a command line argument. There will be only one bmp file to mirror. It is assumed the width of input image is a multiple of 4 and no more than 1680. Please refer to homework 9 (only the wiki page is needed) for more information on bitmap format.
Sample Execution
./a.out BMP_wiki.bmp
Sample Output File
mirrored.bmp
Tip
You can use mspaint (Start -> Run -> mspaint) to mirror a bitmap file easily (just for checking).
Test Data
You can download the test data (which JudgeGirl uses) from here.
Task Description
Write a program to mirror a bitmap file (flip horizontally). We assume that the bitmap file follows the following format. We also assume that each pixel has three bytes.
In this problem you need to mirror a bitmap file and output the result as "mirrored.bmp". The filename of the bmp file will be given as a command line argument. There will be only one bmp file to mirror. It is assumed the width of input image is a multiple of 4 and no more than 1680. Please refer to homework 9 (only the wiki page is needed) for more information on bitmap format.
Sample Execution
./a.out BMP_wiki.bmp
Sample Output File
mirrored.bmp
Tip
You can use mspaint (Start -> Run -> mspaint) to mirror a bitmap file easily (just for checking).
Test Data
You can download the test data (which JudgeGirl uses) from here.