Format conversion in memory buffers (no hard disk r/w)
Posted: 2009-03-03T23:50:49-07:00
Hi ,
Can somebody suggest for follwoing scenario:
We will recieve a gif file as a buffer(file handler)
and we want it to conver to a output buffer in png format in a buffer
(Important - I dont want to write the output file in hard disk )
I looked at the example on the site (core.c) and see follwoing 3 main issues
(i) The WriteImageAPI does not provide a way to output to a buffer
(ii) How to specify the destination format ( note- i am not specifying the filename.Is there nay alternative way)
(iii) Tried ReadImage to read from buffer but it is not working
Please see the code i wrote..
Can somebody suggest how to fill the gaps
or ***alternative APIs**** other the ReadImage and WriteImage to achieve the same
//char buffer input contains image data and input_len contais its length
/**************************
QUERY - Is the below way to read supported
as it is not working
**********************/
image_info->file = fmemopen(input, input_len, "r");
images=ReadImage(image_info,exception);
size_t size;
char * output;
FILE *output_file = open_memstream(output, &size);
/***********************
QUERY
How to specify the output buffer/file handler below ( we dont have filename string
as we dont want to write to hard disk) ?
*****/
WriteImage(image_info,images);
Thanks in Advance
Can somebody suggest for follwoing scenario:
We will recieve a gif file as a buffer(file handler)
and we want it to conver to a output buffer in png format in a buffer
(Important - I dont want to write the output file in hard disk )
I looked at the example on the site (core.c) and see follwoing 3 main issues
(i) The WriteImageAPI does not provide a way to output to a buffer
(ii) How to specify the destination format ( note- i am not specifying the filename.Is there nay alternative way)
(iii) Tried ReadImage to read from buffer but it is not working
Please see the code i wrote..
Can somebody suggest how to fill the gaps
or ***alternative APIs**** other the ReadImage and WriteImage to achieve the same
//char buffer input contains image data and input_len contais its length
/**************************
QUERY - Is the below way to read supported
as it is not working
**********************/
image_info->file = fmemopen(input, input_len, "r");
images=ReadImage(image_info,exception);
size_t size;
char * output;
FILE *output_file = open_memstream(output, &size);
/***********************
QUERY
How to specify the output buffer/file handler below ( we dont have filename string
as we dont want to write to hard disk) ?
*****/
WriteImage(image_info,images);
Thanks in Advance