Hello,
The raw format "interleaved" or "planar" isn't compatible at all with the bmp format (with or without header) :
Atari: interleaved on 4 bitplanes (=16 colors)
Amiga: planar on 5 bitplanes (=32 colors)
Interleaved and planar use indexed color (on 4 or 5 bitplanes) which refer to a color inside a color map table (usually called palette).
BMP uses (mainly) direct color encoding (something like RGB, ARGB, etc.), and don't use a palette.
The source code contains the algorithm: "raw (interleaved and planar for 4 or 5 bitplanes) => bmp (ARGB)".
You need an algorithm which do the opposite: "bmp (ARGB) => raw (interleaved or planar)" (depending of the target system).
This is not easy because "indexed color => direct color" is trivial, but "direct color => indexed color" isn't.
Imho, it will be easier to extract the sprites (from the dump, not the PNG) to an indexed color format (4 or 5 bitplanes, depending of the system), edit them with a tool compatible with the indexed color format, then convert them back.
On which platform do you want to do the mod ? (atari, amiga, pc ?)
PS: you can read :
-
http://en.wikipedia.org/wiki/Color_depth if you need some explanation about indexed/direct color format.
-
http://en.wikipedia.org/wiki/Indexed_color#Image_file_formats_supporting_indexed_color for some (not exhaustive) file formats supporting indexed color.