top of page

Written 18th October 2018, by S.A.Ray

MD Dev part 4: Bitmap files

The Megadrive, and most early machines, required image files that included colour palette data.

​

In today's workshop we shall create a bitmap file in MS Paint and then use GiMP to add the palette data to it.  Lets get cracking...

Creating the Bitmap

First we need to make the basic bitmap file.  Using MS Paint, create a 32*32 image and fill it with the colour black.  Remembering that a Megadrive palette can hold 16 colours, you shall make an image with just four; red, green and blue with black being the background. The remaining 12 colours will remain unused.

​

Bearing in mind 32*32 is a very small resolution, we shall just paint three thin lines with red, green and blue.  Leave some areas of the image black, which will be useful for a future tutorial covering Sprites.

​

When you have created your masterpiece, save it as a standard bitmap file with the 24-bit colour option.

​

Creating the palette

Our second step is to create and add the palette data to the bitmap file, and we shall do this using GiMP.  GiMP is a feature rich, image editing program which can create images with palette data.  If you haven't done so already then google "gimp" and download and install it.

​

If you haven't used GiMP before then it can be daunting at first, but we don't need to do much anyway, so don't worry...

​

Using File->Open, from the menu bar, open the bitmap file you created in MS Paint.  Then from the menu bar, once again, select Image->Mode->Indexed...

​

This will bring up a dialog box with the title "Indexed Colour Conversion".  The only option that should be checked is "Generate Optimum Palette" with a maximum of 16 colours.  You shouldn't need to touch anything in this dialog box, so just click "Convert".  GiMP will then generate the colour palette data for you.

​

With our palette data created all that's left is to select File->Export As from the menu bar and save it as a Windows BMP image.   Congratulations, you now have a palettized bitmap file ready for use in your Megadrive programs.

​

Things to remember...

Bitmap images are stored in two ways; encoded and Indexed.  

​

Encoded is the more modern-day method, where the pixel data will have the colour data bits encoded directly into the pixels themselves.  So the image we created in MS Paint was saved in 24-bit mode, where each element of red, green and blue were saved in 8-8-8 format( 8 bits each ).  This method allows for better image quality but at the expense of storage and speed, although its not really an issue with todays graphics adapters.

​

Indexed( using a palette ) is the older method, but it was faster, required less storage and could produce some very interesting colour-rotating effects with minimal effort.  The main issue was the hassle involved in generating the palette data and manipulating it in an image editing program.

​

When creating bitmaps for your Megadrive programs I recommend making the "master" in 24 or 32 bit encoded format and then creating a copy when exporting the palette version in GiMP.  Although GiMP will make a "best guess" on the colours for the palette( loss in colour shade quality ), you have an original to fall back on incase you make a mistake when converting to indexed mode.  Also, should you wish to make a port of your program that doesnt use a palette, you have a version ready to use for encoded programs for more modern machines. 

​

Lastly, bringing an encoded bitmap into GiMP will simplify the part where you switch to the indexed mode.  If you load in a 16 or 256 colour bitmap, the "Indexed Colour Conversion" dialog box will not appear.

​

I'd like to thank you for joining me today and look forward to seeing you again next time.

​

Have fun!

​

...

...

bottom of page