title: Bitmap point processing
body: <p>would appreciate some brainstorming help for one of my assignments. I am to write a program that does basic point processing of a .bmp image. Program will open a .bmp file for reading and writing and will not change any part of the header, but the pixel values in the file according to command line arguments:</p>
  
  <pre><code>-fromrow x, where x specifies the bottommost row to process
  -torowx, where x specifies the topmost row to process
  -fromcol x, where x specifies the leftmost column to process
  -tocol x, where x specifies the rightmost column to process
  -op x, where x is one of the following:
      - 1 = threshold the image (any pixel value in the specifies range over 127 is changed to 255, and pixel values 127 or less is changed to 0)
      - 2 = negative (any pixel value p in the specified range is changed to 255-p)
  
  To process image data, you will need to make use of the following:
  - each pixel value is an unsigned char
  - the number of rows in the image is stored as an int at position (byte address) 22 in the file
  - the number of columns in the image is stored as an int at position (byte address) 18 in the file
  - the position at which the pixel data starts is an int stored at position (byte address) 10 in the file
  - pixel information is stored row by row, starting from the bottommost row in the image (row 0) and progressing upwards. within a row; pixel information is stored left to right. padding is added to the end of each row to make row length a multiple of 4 bytes (if the row has 479 columns, there is one extra padding at the end of the row before the next row starts)
  </code></pre>
  
  <p>I'm a bit lost as to how to begin, but I figure I should make a struct bitmap first like so?</p>
  
  <pre><code>struct bitmap {
      unsigned int startrow;
      unsigned int endrow;
      unsigned int startcol;
      unsigned int endcol;
  }
  </code></pre>
  
  <p>Can anyone help walk me through what I would need to do for the byte addresses that the assignment references? Any other brainstorming advice would be greatly appreciated as well. Thanks!</p>