rawimage
Tool
tools/formats/rawimage.py(program, Formats). Turn raw pixel data into a PNG: a dump of video memory, a screen saved by a DOS game, or a block of a data file that may hold a picture.
Run it with ./gameframe run rawimage ARGS or python3 tools/formats/rawimage.py. Source on GitHub.
Its own help
This is the help text in the tool itself, as ./gameframe tool rawimage prints it.
text
Turn raw pixel data into a PNG: a dump of video memory, a screen saved by a DOS game, or a
block of a data file that may hold a picture.
Usage: rawimage.py INPUT OUT.png --mode MODE [--width W] [--height H] [--offset N]
[--palette FILE] [--palette-offset N] [--start N] [--scale S]
MODE how the bytes hold pixels:
linear8 one byte per pixel, a palette index (VGA mode 13h, most 256-colour data)
modex VGA unchained 256 colours: INPUT holds the four planes one after the
other (4 x 64 KB), pixel x is in plane x % 4 (Mode X)
planar4 EGA and VGA 16 colours: four bit planes one after the other, one bit
per pixel in each (INPUT holds 4 x the plane size)
cga2 CGA 320 x 200 in 4 colours: 2 bits per pixel, even lines from 0 and
odd lines from 0x2000 (a dump of B800:0000)
packed4 4 bits per pixel, two pixels per byte, high nibble first
packed2 2 bits per pixel, high bits first; packed1 1 bit per pixel
rgb565, rgb555 16-bit colour, little-endian
--width, --height the size in pixels (defaults 320 x 200; Mode X 320 x 240)
--offset N skip N bytes of INPUT first; --start N starts at pixel row N's address
for modex and planar4 (a second page, a scrolled screen)
--palette FILE a palette: 768 bytes of RGB (6-bit VGA DAC values are scaled up when
no value is above 63), or a JASC .pal text file; --palette-offset N to
read it from inside a bigger file. Without it: the default VGA palette
for linear8 and modex, the EGA palette for 16 colours, CGA palette 1
--scale S make each pixel S x S (for looking, not for comparing)
Two uses. Run a picture you captured from the original (a DOSBox-X memory dump of A000:0000,
an emulator's video RAM) into a PNG, to compare with the port's frame (re-verify). Or try a
block of a data file as a picture: if a 64,000-byte block shows a screen at 320 x 200 with
the right palette, the format is a raw bitmap. A wrong width shows as slanted stripes: change
it until the picture stands straight.
Writes PNG with the standard library only.Named by
Skills: re-observe, re-format.