Click here to get back home

best way to store binary image data in a variable using image magick

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
best way to store binary image data in a variable using image magick Jack 01-25-2008
Posted by Jack on January 25, 2008, 1:17 am
Please log in for more thread options
Hi all,

Just wanted to know the code for doin this, such that I can use the
variable for doing other kinds of methods against it..

I tried this, and I can printout the binary data, but I am finding you
can assign the image data to a variable for further processing.. any
ideas ? I noticed that this line: $img->Write('jpg:-'); actually
displayed the image data, but how do I assign that binary data to a
variable ??

use Image::Magick;
my $img = new Image::Magick;
$x= $img->Read("c:\tmp\ean81.bmp");

## doesnt work: $img->Write('$temp');

Posted by Jack on January 25, 2008, 1:19 am
Please log in for more thread options
> Hi all,
>
> Just wanted to know the code for doin this, such that I can use the
> variable for doing other kinds of methods against it..
>
> I tried this, and I can printout the binary data, but I am finding you
> can assign the image data to a variable for further processing.. any
> ideas ? =A0I noticed that this line: =A0 =A0$img->Write('jpg:-'); =A0 actu=
ally
> displayed the image data, but how do I assign that binary data to a
> variable ??
>
> use Image::Magick;
> my $img =3D new Image::Magick;
> $x=3D $img->Read("c:\tmp\ean81.bmp");
>
> ## doesnt work: =A0 =A0$img->Write('$temp');

Hi forgot to say when I print $img or $x I get ---
Image::Magick=3DARRAY(0x2260a4)

Posted by John W. Krahn on January 25, 2008, 5:59 am
Please log in for more thread options
Jack wrote:
>
> Just wanted to know the code for doin this, such that I can use the
> variable for doing other kinds of methods against it..
>
> I tried this, and I can printout the binary data, but I am finding you
> can assign the image data to a variable for further processing.. any
> ideas ? I noticed that this line: $img->Write('jpg:-'); actually
> displayed the image data, but how do I assign that binary data to a
> variable ??
>
> use Image::Magick;
> my $img = new Image::Magick;
> $x= $img->Read("c:\tmp\ean81.bmp");
>
> ## doesnt work: $img->Write('$temp');

Did you read their web page at:

http://www.imagemagick.org/script/perl-magick.php

Hint: ImageToBlob



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall

Similar ThreadsPosted
how to simply parse raw image data and output to an image file ? January 3, 2008, 11:19 am
Image magick palette July 30, 2004, 9:16 pm
Image::Magick trouble February 11, 2005, 12:21 pm
Reduce colors with Image::Magick July 1, 2007, 8:41 am
Image::Magick problem after (failed?) install August 19, 2004, 5:16 pm
How can I use Image::Magick moduel on Windows system ? December 10, 2005, 3:38 pm
Image Magick - Exception 445: pixel cache not open November 18, 2004, 11:51 pm
Image::Magick and perl script STDOUT problem July 20, 2005, 10:05 am
Good documentation or good source examples for Image::Magick or converter from commandline to perl April 1, 2008, 5:23 pm
Image data parsing October 27, 2004, 3:36 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap