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

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)
Sun raster files, and 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.


  1. Download the three Sun Raster Images, and from (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.

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.)

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.

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

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

Input files:,, (each 257 KB)
Output file: (786,486 bytes compressed to 754,464 -- not much)

Updated 18 Feb 2002

since 1 Nov 1998