X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=tools%2Fpngdump%2Fmain.c;fp=tools%2Fpngdump%2Fmain.c;h=908818db13d0e9cf51dc9e72847dea83d45451a3;hb=3eebc6b38f3ad1fd082ae9d4d3263c42c384951c;hp=a2b37fd2daaa5cfde6a5267ced6083561c1b56b7;hpb=c702b53199b0daae33e67b0d398b460995cd374e;p=gba_blender diff --git a/tools/pngdump/main.c b/tools/pngdump/main.c index a2b37fd..908818d 100644 --- a/tools/pngdump/main.c +++ b/tools/pngdump/main.c @@ -84,7 +84,17 @@ int main(int argc, char **argv) switch(mode) { case 0: - fwrite(img.pixels, 1, img.scansz * img.height, out); + if(img.bpp > 8 || img.cmap_ncolors == 0 || img.cmap_ncolors > 16) { + fwrite(img.pixels, 1, img.scansz * img.height, out); + } else { + /* pack into nibbles */ + unsigned char *ptr = img.pixels; + for(i=0; i