--wrap,kds_s2000w_client_status_session,\
--wrap,kds_s2000w_client_get_image,\
--wrap,kds_s2000w_client_get_metadata,\
---wrap,kds_s2000w_convert_jpg_to_pnm,\
+--wrap,kds_s2000w_convert_tiff_to_pnm,\
--wrap,kds_s2000w_client_delete_image,\
--wrap,kds_s2000w_client_set_option,\
--wrap,load_config,\
MagickCoreTerminus();
}
-void kds_s2000w_convert_jpg_to_pnm(blobdata* in, blobdata* out)
+void kds_s2000w_convert_to_pnm_with_depth(blobdata* in,
+ blobdata* out,
+ int depth,
+ const char* format)
{
- debug_printf(ALL, "kds_s2000w_convert_jpg_to_pnm");
- kds_s2000w_convert_jpg_to_pnm_with_depth(in, out, -1);
-}
-
-void kds_s2000w_convert_jpg_to_pnm_with_depth(blobdata* in, blobdata* out, int depth)
-{
- debug_printf(ALL, "kds_s2000w_convert_jpg_to_pnm_With_depth");
+ debug_printf(ALL, "kds_s2000w_convert_to_pnm_With_depth");
+
ExceptionInfo* exception = NULL;
Image* input_image = NULL;
ImageInfo* image_info = NULL;
+ char* streamname = NULL;
+ int str_length = 0;
exception = AcquireExceptionInfo();
image_info = CloneImageInfo(NULL);
- const char* streamname = "streamin.jpg";
- strcpy(image_info->filename, streamname);
+
+ str_length = 10 + strlen(format);
+ streamname = malloc(sizeof(char) * str_length);
+ snprintf(streamname, str_length, "streamin.%s", format);
+ memcpy(image_info->filename, streamname, str_length);
input_image = BlobToImage(image_info, in->data, in->size , exception);
+
input_image->properties = NULL;
if (exception->severity != UndefinedException)
if (input_image == NULL) {
DestroyImageInfo(image_info);
DestroyExceptionInfo(exception);
+ free(streamname);
+ streamname = NULL;
return;
}
DestroyExceptionInfo(exception);
exception = AcquireExceptionInfo();
image_info = CloneImageInfo(NULL);
- strcpy(image_info->filename, "streamout.pnm");
+ memcpy(image_info->filename, "streamout.pnm", 14);
if (depth > -1)
SetImageDepth(input_image, depth);
DestroyImageInfo(image_info);
DestroyImage(input_image);
DestroyExceptionInfo(exception);
+ free(streamname);
+ streamname = NULL;
+}
+
+void kds_s2000w_convert_jpg_to_pnm_with_depth(blobdata* in, blobdata* out, int depth)
+{
+ debug_printf(ALL, "kds_s2000w_convert_jpg_to_pnm_With_depth");
+ const char* extension = "jpg";
+ kds_s2000w_convert_to_pnm_with_depth(in, out, -1, extension);
+}
+
+void kds_s2000w_convert_tiff_to_pnm(blobdata* in, blobdata* out)
+{
+ const char* extension = "tiff";
+ debug_printf(ALL, "kds_s2000w_convert_tiff_to_pnm");
+ kds_s2000w_convert_to_pnm_with_depth(in, out, -1, extension);
}
\ No newline at end of file