# HG changeset patch # User Matti Hamalainen # Date 1560490398 -10800 # Node ID a8b4e9c9f337399a87429ef3c64f6179d8a29964 # Parent 8cd2a821e8a075c474b8288a780ac32fd64e3002 Set PCX header palette information correctly for grayscale data images. diff -r 8cd2a821e8a0 -r a8b4e9c9f337 tools/libgfx.c --- a/tools/libgfx.c Fri Jun 14 08:17:00 2019 +0300 +++ b/tools/libgfx.c Fri Jun 14 08:33:18 2019 +0300 @@ -1575,10 +1575,15 @@ hdr.xmin = hdr.ymin = 0; hdr.xmax = (img->width * spec.scaleX) - 1; hdr.ymax = (img->height * spec.scaleY) - 1; - hdr.palInfo = 1; hdr.hScreenSize = hdr.hres; hdr.vScreenSize = hdr.vres; + switch (spec.pixfmt) + { + case DM_PIXFMT_GRAYSCALE: hdr.palInfo = 2; break; + default: hdr.palInfo = 1; break; + } + // TODO XXX .. maybe actually compute these asdf hdr.bitsPerPlane = 8; hdr.nplanes = dmImageGetBytesPerPixel(spec.pixfmt);