[magick-users] API for passing image data
zentara
zentara1 at sbcglobal.net
Wed Dec 24 07:59:53 PST 2008
On Wed, 24 Dec 2008 09:39:59 -0600
Carl Karsten <carl at personnelware.com> wrote:
>I am trying to do in process conversions. I generate pdf, I need that converted
>to a png (no disk files, no stdio.)
>
>I am not familiar with the AIP. I need a clue on how I can pass in the data
>instead of a file name, and how to retrieve a converted image.
>
>I am trying to use PythonMagickWand [1] so if you can answer in the form of
>python code, one less thing for me to do.
>
>[1]http://public.procoders.net/PythonMagickWand/docs/html/index.html
>http://www.procoders.net/?p=121
>
>Carl K
I'm assuming that you get the pdf from the stdout of some other program.
This isn't Python, but it works in Perl and may show you a clue for Python.
#!/usr/bin/perl
use warnings;
use strict;
use Image::Magick;
# simulate a pdf in memory, like from another program
my $rawpdf = `cat zzimage.pdf`;
my $output = Image::Magick->new();
$output->BlobToImage( $rawpdf );
$output->Write('zout.png');
#or if you want to write to stdout
#binmode STDOUT;
#$output->Write('png:-');
__END__
zentara
--
I'm not really a human, but I play one on earth.
http://zentara.net/Remember_How_Lucky_You_Are.html
More information about the Magick-users
mailing list