From a925e50d232379bb3b0966eadfc37e1ef8607cec Mon Sep 17 00:00:00 2001 From: Jonathan Campbell Date: Thu, 25 Jun 2020 23:35:21 -0700 Subject: [PATCH] [Pipeline] bmp2arr: needs palette, or ImageMagick is not happy --- Pipeline/bmp2arr.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Pipeline/bmp2arr.c b/Pipeline/bmp2arr.c index 83ae9610..e7ea6a6b 100644 --- a/Pipeline/bmp2arr.c +++ b/Pipeline/bmp2arr.c @@ -214,10 +214,10 @@ int rec98_bmp2arr_save_debug_bmp_out(struct rec98_bmp2arr_task *t) { /* BITMAPFILEHEADER */ memcpy(bmp_tmp+0, "BM",2); - *((uint32_t*)(bmp_tmp+2 )) = htole32(14+40+(t->bmp_height*t->bmp_stride)); /* bfSize */ + *((uint32_t*)(bmp_tmp+2 )) = htole32(14+40+4*2+(t->bmp_height*t->bmp_stride)); /* bfSize */ *((uint16_t*)(bmp_tmp+6 )) = htole16(0); *((uint16_t*)(bmp_tmp+8 )) = htole16(0); - *((uint32_t*)(bmp_tmp+10)) = htole32(14+40); /* bfOffBits */ + *((uint32_t*)(bmp_tmp+10)) = htole32(14+40+4*2); /* bfOffBits */ write(fd,bmp_tmp,14); /* BITMAPINFOHEADER */ @@ -234,6 +234,17 @@ int rec98_bmp2arr_save_debug_bmp_out(struct rec98_bmp2arr_task *t) { *((uint32_t*)(bmp_tmp+36)) = htole32(0); write(fd,bmp_tmp,40); + /* color palette */ + bmp_tmp[0+0] = 0x00; + bmp_tmp[0+1] = 0x00; + bmp_tmp[0+2] = 0x00; + bmp_tmp[0+3] = 0x00; + bmp_tmp[4+0] = 0xFF; + bmp_tmp[4+1] = 0xFF; + bmp_tmp[4+2] = 0xFF; + bmp_tmp[4+3] = 0x00; + write(fd,bmp_tmp,4*2); + /* the bits */ y = t->bmp_height - 1; do {