Image Processing
Create Mandrill BMP  Lab Report
Create 24-bits/pixel BMP from Sun Raster Files of Mandrill Monkey

Purpose
The purpose of this program, CreateMandrillBMP, is to create the "famous" Mandrill image, which is a 512-by-512 pixel by 24 bits/pixel image, from the Red, Green and Blue Sun raster files.

Materials and Equipment

Software Requirements
Windows 95
Delphi 3 (to recompile)
CreateMandrillBMP.EXE
Sun raster files
mandrill.blue, mandrill.green and mandrill.red from FTP site

Hardware Requirements
VGA display in high color or true color mode. An 800-by-600 display will allow you to see the whole image at one time.

Procedure

  1. Download the three Sun Raster Images mandrill.blue, mandrill.green and mandrill.red from ftp://ftp.vislist.com/IMAGERY/MANDRILL (or see" Download" below).. Each of these files is 257 KB.
  2. Double click on the Mandrill icon to start the program, CreateMandrillBMP.EXE
  3. Press the Read button to read the three files downloaded in step 1 above. The 512-by-512 pixel by 24 bits/pixel image (769 KB), Mandrill.BMP, is automatically created and written to disk.

Discussion
Three separate FileStreams, StreamRed, StreamGreen, StreamBlue, were used to step through the Sun raster files. After skipping over the 32-byte, each 512-byte scanline was read and put into the TBitmap scanline of a pf24bit TBitmap.

The Show Image program indicates this image has 230,427 unique RGB colors!  This is amazing since the image only has 262,144 pixels.  Because of the large number of unique colors, this image does not compress well.  (See ZIP stats below.)

Conclusions
The Mandrilll.BMP image is a "classic" image that is useful in a variety of image processing and graphics experiments, such as color plane separation.


Keywords
File Stream, Sun Raster File, TRGBArray, TRGBTriple, pf24bit PixelFormat, TBitmap, Bitmap.SaveToFile

Download
Delphi 3 Source and EXE (113 KB): CreateMandrillBMP.ZIP

Input files:  mandrill.red, mandrill.green, mandrill.blue (each 257 KB)
Output file:  mandrill.zip (786,486 bytes compressed to 754,464 -- not much)


Updated 18 Feb 2002


since 1 Nov 1998