ctswap

ctswap is a little python script to replace the color table in a BMP image. It does not convert between BMP types or palette sizes, and it does not attempt to match the colors in the image to the colors in the palette. It simply writes the new color table.

I wrote ctswap to convert Windows boot logos to human-viewable BMP files. Windows 2000 and XP store their boot logos as bitmap resources in the ntoskrnl.exe file. You can actually use any 4-bit (16-color) BMP of the correct dimensions, but the fade-in effect that Windows does when it displays the boot logo will only work properly if you set all the colors in the image to black. The palette that the kernel actually uses to display the image is in a different place in ntoskrnl.exe.

If you want to replace your Windows 2000/XP boot logo, try Google.

ctswap reads the new color table from another BMP file or from a text file. The text file format is simple. Each line has three numbers, representing respectively the red, green, and blue color values, ranging from 0 to 255 and separated by spaces. Lines that don't match this pattern are ignored. This format is compatible with the JASC PAL format. An example follows:

0 0 0
255 0 0
0 255 0
0 0 255
128 128 128
...and so on

ctswap should work on any BMP image regardless of compression. It will not work on 24-bit BMP files because these do not have color tables.

Usage

You need a working python installation. You can get python here: python.org.

Download the Python script.

To read the palette from 16colors.bmp, read the image data from oldimage.bmp, and write to newimage.bmp:

python ctswap.py -o newimage.bmp 16colors.bmp oldimage.bmp

To read the palette from custom.txt, read the image data from oldimage.bmp, and write to standard output:

python ctswap.py custom.txt oldimage.bmp

Creative Commons License All content licensed under a Creative Commons Attribution-ShareAlike 3.0 United States License, unless otherwise noted.
Hosted by UGCS