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

J

Jack

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');
 
J

Jack

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');

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

John W. Krahn

Jack said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top