CS420 Fall 2004 Homework, HW 8 (Week 9): Examining Losses in Lossless Compression


  1. Write a program, brightenbmp, that accepts an input file name, an output file name and a floating point value on the command line. The program should open and parse the 24bit Microsoft bmp file specified as input into an RGB buffer, multiply each R, G, and B component of each buffer pixel by this value, then encode the results as a 24 bit bmp data written to the output file specified on the command line. Use saturation math so that component values are not allowed to exceed the legal 0 to 255 range.


  1. Write a program, deltabmp, that accepts the names of two 24bit bmp files to read and a third name to output to.  Dynamically (if possible) read the contents of the two input files subtracting the component values of the second from the first and store the results in as 24bit bmp in the output file named on the command line. (ex: Routput=R1input – R2input). The input files should be identical in dimension.



  1. Experiment with unmasking:

a)      Find or create a small photographic (not computer generated rendering) jpeg file containing both bright images and shadows. Use mspaint or other program to save this file as a 24bit bmp file. Use brightenbmp to brighten the bmp version of the jpeg file until compression artifacts are exposed.  mspaint maybe used to view the results.


b)      Describe the compression artifacts found. (if compression artifacts do not become apparent it may be necessary to begin with a jpeg file compressed using a higher compression/lower quality setting)


  1. Experiment with pixel comparison:

a)      Find or create a small photographic origin uncompressed or lightly compress jpeg file (lightly compressed the uncompressed image). Create a more highly compressed jpeg version of this file. Convert the ‘original’ and more highly compressed files to 24bit bmp and use delta to create a differenced image. Any non-black pixel represents a change. brightenbmp may be used to make changes more obvious (unchanged pixels will remain black even if multiplied…)


NOTE: Original image used should be jpeg encoded since jpeg will convert an input file’s dimensions to an even multiple of 8.


b)      Describe the differences.



  1. I assume that the coding will be straightforward and will be grading on the quality of your observations.
  2. You may use C, C++, or C#
  3. You may use the bmp encode and decode source code provided on the CD accompanying the Miano text, example code from http://msdn.microsoft.com, or any other source as long as you document it’s derivation and confine code you do not write to their own files/modules.
  4. Please provide the following for full credit:

a)      Text file describing answers to 3b, 4b (please identify the image files used)

b)      All source code

c)      brightenbmp.exe, and deltabmp.exe

d)     All image files