Home > Programming & scripting, Python > Test-application for drawing using BMPDecode and pygame

Test-application for drawing using BMPDecode and pygame

December 26th, 2006

Might as well post the application I wrote for testing the BMPDecoder.
It has pygame as a dependency since it uses it’s SDL-bindings to draw to screen.

If you want to play around with BMPDecode it is nice to have something to test the code with.
Download test-application

An example of the text output of the test application (header data)

> python testdecoder.py 4bitc.bmp
self.bfType:  BM
self.bfSize:  922
self.bfReserved1:
self.bfReserved2:
self.bfOffBits:  118
self.biSize:  40
self.biWidth:  127
self.biHeight:  64
self.biPlanes:  1
self.biBitCount:  4
self.biCompression:  2
self.biSizeImage:  804
self.biXPelsPerMeter:  0
self.biYPelsPerMeter:  0
self.biClrUsed:  0
self.biClrImportant:  0

It also draws the bitmap using pygame (an ugly pixel-drawing hack I made… there are probably better ways).

Screenshot of some instances of the program:

Also… on another note.
Did you know that imagemagick converts 4-bit bitmaps (or pretty much any bitmap) to a 24-bit bitmap when using convert for doing resizing or whatever?
I didn’t :)

buffi Programming & scripting, Python

  1. No comments yet.
  1. No trackbacks yet.