Specifying the file format when writing to a Blob

Marten Lehmann <[email protected]> Wed, 05 Sep 2012 20:55:20 +0200
Newsgroups gmane.comp.video.graphicsmagick.apis
Message-ID <[email protected]>
Hello,

I don't know how to specify the file format when writing to a Blob. I'm 
using GraphicsMagick to convert multipage TIFF images to PDF files. 
Ideally, I would read the image from a database and return it in-memory 
by a webservice.

So far, the first part works fine: I'm reading the TIFF image from a 
database and putting it into a GraphicsMagick Blob. Then I'm using the 
readImages() function to create the Magick++ Container from that Blob.

The second part however, is not fully on-the-fly and in-memory as I'd 
like to have it:

I can use writeImages() to either write to a filename like whatever.pdf 
and then the SetImageInfo() function would extract the filetype pdf from 
the extension and set image_info->magick to PDF and image_info->affirm 
to MagickTrue.

I can also use a filename like pdf:- and the full output would be 
written as PDF to stdout. But as I'm using all this behind the pgmagick 
library within Python, it is not that easy to fetch the output.

So what I'm really missing is a way to specify a file format when using 
writeImages() with a Blob target. With the output in the Blob, I could 
really do everything in-memory, without workarounds like fetching stdout 
or using temporary files which will be deleted after reading.

Any ideas? Anything existing, that I have overseen?

Kind regards
Marten

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/