Razorback
NewsProjectsGuidesResourcesContact
 Guide Index Quick Links


How to Add Color to a Monochrome Bitmap

Created on October 5, 2020

Contents
  1. Converting an Image to a Monochrome Bitmap

Windows 95 setup wallpaper

See this beautiful wallpaper? Everyone who's worked with Windows 95 must have at one point. It may not look like it at first glance, but SETUP.BMP does not have a color profile! Just how are you expected to color a monochrome bitmap image? You can convert it into a 16 color bitmap or anything like that if you want, but the extra bits will result in a bountiful of wasted space. It turns out that it's not so hard; all you need is a hex editor, and some image editor if you're making a new bitmap!

Converting an Image to a Monochrome Bitmap

Color image ISOTOXIN_LIQUID.jpg open in Photoshop 5.5

Photoshop is my go-to option for editing images, but you may be using GIMP or Paint.NET. To convert any image to a monochrome bitmap, you basically have to discard the its color profile and tell it to use 1-bit color.

Photoshop 5.5 menu: Image > Mode > Grayscale

With your image opened in Photoshop, you only need to do a few things: first, select Mode > Grayscale from the Image drop down menu. Click OK to discard color information.

ISOTOXIN_LIQUID.jpg without color

Now, if your image looks too bright or to dark at this stage, you may want to undo the operation and adjust the brightness and contrast before trying again. I'm satisfied with how this looks, so let's proceed.

Cropping ISOTOXIN_LIQUID.jpg with fixed target size set to 4x3 inches

The Bitmap option will become available to use, but first, if you're dealing with a high resolution image, it may be a good idea to scale it down before converting it in case the resolution may be too excessive. 1920x1366 is way too much for any typical resolution used by a Windows 95 system, so if you want this to be a 4:3 wallpaper, first crop the image, constraining the proportions using the Crop Options panel. This way you don't have to worry about awkward stretch distortion or wasted/missing pixels. Drag your mouse across the area you want to keep, and press Enter to crop the image.

Image Size dialog set to 640x480 pixels, Constrain Proportions enabled, bicubic resampling

Now, scale down your image by selecting Image Size from the Image menu. I want to scale down this image to fit a 640x480 resolution, so with constrained proportions enabled, I type 640 into the width box and click OK.

Bitmap dithering dialog

From the Image drop down menu, go to Mode > Bitmap. You can select a dithering method using the dialog which appears.

ISOTOXIN_LIQUID.jpg at quarter zoom, looks like white noise

When applying the conversion, it may look like you've only generated white noise. Don't worry, just zoom in at 100% and you'll get a much better idea of what your bitmap will look like.

ISOTOXIN_LIQUID.jpg at full zoom, looks more like it once was

Now, save your image as a bitmap file under the Windows format with a depth of 1 bit. Once that's done, you can go on to the next section; you'll need a hex editor such as HxD or XVI32 for this.

Photoshop save dialog, saving ISOTOXIN.bmp as .BMP file

%h:edit-colors|Editing Colors in a Monochrome Bitmap

HxD displaying contents of ISOTOXIN.bmp, highlighted offsets 36h to 38h and 3Ah to 3Ch

Open a monochrome bitmap in a hex editor. I've highlighted two sets of bytes you'll need to turn your attention to. The first set dictates the color of the "white" pixels, and ranges from offsets 36h to 38h. The second set representing "black" pixels starts at 3Ah and ends at 3Ch.

Even if you are familiar with hexadecimal representations of colors (as should be the case if you design web pages), there's still one thing to be mindful of. When you select a color through some interface, it may display the hex values of each color in the order of red, green, and blue. However, the raw data is actually stored in reverse order, so when you modify it, you have to think of it as BGR as opposed to RGB.

Photoshop color picker, selected color #5888B9

If you wanted a color like #5888B9 for the first color, you would write B9 88 58 starting at offset 36h. While you can pick any color you want, it may be better to select a color more exact to a 16-color palette, i.e. use combinations of 00h, 80h, and FFh. Refer to the table below to find the colors you might want.

Color RGB hex value BGR hex data
White #FFFFFF FF FF FF
Maroon #800000 00 00 80
Dark Green #008000 00 80 00
Dark Yellow #808000 00 80 80
Indigo #000080 80 00 00
Dark Purple #800080 80 00 80
Dark Teal #008080 80 80 00
Grey #808080 80 80 80
Black #000000 00 00 00
Red #FF0000 00 00 FF
Green #00FF00 00 FF 00
Yellow #FFFF00 00 FF FF
Blue #0000FF FF 00 00
Magenta #FF00FF FF 00 FF
Cyan #00FFFF FF FF 00

ISOTOXIN.bmp monochrome bitmap with green and dark green colors

To make the monochrome colors match up well with the original image, type 00 FF 00 starting at offset 36h to assign the white pixels to green. Then, at offset 3Ah, type 00 80 00 to set the black pixels to dark green. The image now looks pretty close to the original, doesn't it? But maybe your tastes have changed... you don't really want green toxic liquid for your wallpaper. No... what you really want is a wallpaper representing the blood of the noobs you gratuitously gibbed in a round of QuakeWorld DM!!! Try taking the picture below and modifying it to create something like the one underneath it:

Green water

ISOTOXIN.bmp with red liquid

So, that's a neat little way to add color to a raw bitmap file without having all the excess size of even a 16-color bitmap. Monochrome bitmaps at 640x480 are about 37.5 KB, while 16 color bitmaps of the same dimensions are around 150 KB, so the saved storage is very significant if multiple colors are not essential to your image. You can even inject your monochrome bitmap into WINSETUP.BIN in Windows 95 so you have a new setup background to look at when you install the operating system. Hope this helped, and here's to many more guides like this!


Comments

No comments for this page.

Leave a Comment

Name: (required)

Website: (optional)

Maximum comment length is 1000 characters.
First time? Read the guidelines

SORRY NOT GONNA SHOW THIS IN TEXT BROWSER
Enter the text shown in the image: