]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
write blob and write file
authorBastian Dehn <hhaalo@arcor.de>
Mon, 5 Feb 2024 15:32:18 +0000 (16:32 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Mon, 5 Feb 2024 15:32:18 +0000 (16:32 +0100)
src/kds_s2000w_image_converter.c
tools/convert.c

index ed4c277833b561fefaa9b5a42dfdfd7abebc81b1..3237cad11c074f689f44702501f045ae8983053f 100644 (file)
@@ -25,7 +25,7 @@ void kds_s2000w_convert_jpg_to_pnm(blobdata* in, blobdata* out)
 
        exception = AcquireExceptionInfo();
        image_info = CloneImageInfo(NULL);
-       const char* streamname = "stream.jpg";
+       const char* streamname = "streamin.jpg";
        strcpy(image_info->filename, streamname);
        input_image = BlobToImage(image_info, in->data, in->size , exception);
 
@@ -38,8 +38,7 @@ void kds_s2000w_convert_jpg_to_pnm(blobdata* in, blobdata* out)
        DestroyExceptionInfo(exception);
        exception = AcquireExceptionInfo();
        image_info = CloneImageInfo(NULL);
-       strcpy(image_info->filename, "output_test.jpg");
-       WriteImages(image_info, input_image, "output.pnm", exception);
+       strcpy(image_info->filename, "streamout.pnm");
        out->data = ImageToBlob(image_info, input_image, &out->size, exception);
 
        DestroyImageInfo(image_info);
index 16628e97e5b70bd2236d1de1726930ace8798498..d797e88750249865724020d448560deac405a4c2 100644 (file)
@@ -24,11 +24,17 @@ int main(int argc, char* argv[])
        blob.data = malloc(sizeof(char) * blob.size);
        fread(blob.data, blob.size, 1, fptr);
        fclose(fptr);
+       fptr = NULL;
 
        kds_s2000w_convert_init();
        kds_s2000w_convert_jpg_to_pnm(&blob, &output);
        kds_s2000w_convert_terminate();
 
+       fptr = fopen("output.pnm", "w");
+       fwrite(output.data, output.size, 1, fptr);
+       fclose(fptr);
+       fptr = NULL;
+
        free(blob.data);
        blob.data = NULL;
        free(output.data);