In the BMP format for 24-bit true-color images, an image is stored in binary format. The start
Question:
In the BMP format for 24-bit true-color images, an image is stored in binary format.
The start of the file has the following information:
• The position of the first pixel of the image data, starting at offset 10
• The width of the image, starting at offset 18
• The height of the image, starting at offset 22 Each of these is a 4-byte integer value stored in little-endian format. That is, you need to get the integer value as n = bk + 256 · bk+1 + 2562 · bk+2 + 2563 · bk+3, where k is the starting offset.
Each pixel of the image occupies three bytes; one each for red, green, and blue. At the end of each row are between 0 and 3 padding bytes to make the row lengths multiples of four. For example, if an image has a width of 101 pixels, there is one padding byte per row.
Using a RandomAccessFile, turn each pixel of such a BMP file into its negative.
Step by Step Answer: