From: Bastian Dehn Date: Wed, 29 Jan 2025 17:14:51 +0000 (+0100) Subject: change jpg gray convert with pnm X-Git-Tag: v1.0.29^2~3^2~15 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=75640111c9aea576a53ddb028c49f55989db7749;p=sane-kds-s2000w-net.git change jpg gray convert with pnm --- diff --git a/src/kds_s2000w_image_converter_netpbm.c b/src/kds_s2000w_image_converter_netpbm.c index 30e662d..9dffe0f 100644 --- a/src/kds_s2000w_image_converter_netpbm.c +++ b/src/kds_s2000w_image_converter_netpbm.c @@ -190,15 +190,17 @@ void _kds_s2000w_image_gray_jpg_to_pnm(j_decompress_ptr cinfo, } fclose(jpeg_stream); - gray** pixels = malloc(sizeof(gray*) * cinfo->output_height); + xel** pixels = malloc(sizeof(xel*) * cinfo->output_height); for (int i = 0; i < cinfo->output_height; i++) { - pixels[i] = malloc(sizeof(gray) * cinfo->output_width); + pixels[i] = malloc(sizeof(xel) * cinfo->output_width); } int currwidth = 0; int currheight = 0; for (int i = 0; i < decompress_size; i += GRAY) { - pixels[currheight][currwidth] = decompress_data[i]; + pixels[currheight][currwidth].r = 0; + pixels[currheight][currwidth].g = 0; + pixels[currheight][currwidth].b = decompress_data[i]; currwidth++; if (currwidth >= cinfo->output_width) { currwidth = 0; @@ -206,7 +208,7 @@ void _kds_s2000w_image_gray_jpg_to_pnm(j_decompress_ptr cinfo, } } - pgm_writepgm(pnm_stream, pixels, cinfo->output_width, cinfo->output_height, PNM_MAXMAXVAL, 0); + pnm_writepnm(pnm_stream, pixels, cinfo->output_width, cinfo->output_height, PGM_MAXMAXVAL, PGM_FORMAT, 0); for (int i = 0; i < cinfo->output_height; i++) { free(pixels[i]);