AS Perl 629 Image::Magick makes Perl crash when outputting image to file 
Author Message
 AS Perl 629 Image::Magick makes Perl crash when outputting image to file
Hello guys I installed Image::Magick on my XP(win) box, when i want to
output image to file, perl crashes, if i simple want to genirate image
works ok, here the code i have

use Image::Magick;

#$image->Quantize(colorspace=>'gray');

$image = Image::Magick->new;
$image->Set(size=>'100x100');
$image->ReadImage('xc:white');
$image->Set('pixel[49,49]'=>'red');

$text = 'Dude';
$image->Annotate(font=>'test.ttf', pointsize=>40, stroke=>'green', tex
+t=>$text);

//Removing this section doesn't crach Perl
$filename = "test.png";
open(DATA, ">$filename");
$image->Write(file=>DATA, filename=>$filename);
close(DATA);

Thank You very much



Sun, 15 Feb 2004 08:49:21 GMT  
 AS Perl 629 Image::Magick makes Perl crash when outputting image to file
Hi Daniel

It could be, that the www page, which shows it the way you did
it: http://www.simplesystems.org/ImageMagick/www/perl.html
may be wrong. On unix one can open a file for writing twice.
On window it's different (depending on the hacker's capabilities).

If you leave the open(DATA... stuff away and just do a
$image->Write(filename=>$filename); then it might work.
On Linux it swallows both versions, but why would it want
the file name, if the file is already open?

-Per.

Quote:

> ...
> $filename = "test.png";
> open(DATA, ">$filename");
> $image->Write(file=>DATA, filename=>$filename);
> close(DATA);

--


------------------------------------------------------------------



Sun, 15 Feb 2004 10:36:26 GMT  
 AS Perl 629 Image::Magick makes Perl crash when outputting image to file

Quote:
> Hi Daniel

> It could be, that the www page, which shows it the way you did
> it: http://www.*-*-*.com/
> may be wrong. On unix one can open a file for writing twice.
> On window it's different (depending on the hacker's capabilities).

> If you leave the open(DATA... stuff away and just do a
> $image->Write(filename=>$filename); then it might work.
> On Linux it swallows both versions, but why would it want
> the file name, if the file is already open?

This is a plausible answer. The documentation for ImageMagick (Perl-Magick) is notoriously full of errata. Its a huge piece of Open
Source software maintained by a tiny crew who don't care for spending their time updating documentation (as unusual as that may
sound ;-).

The form of the Write function I see in code that I wrote awhile ago (and which I know has worked on Win32) is like this instead of
the above:

 my $returnval = $imageobj->Write('png:output.png');
 warn qq[ALWAYS check your return values from Image::Magick function calls! (IM sez: "$returnval")\n];

So maybe don't do that hash-assignment thing??

   HTH,
     Soren Andersen

--
{{ please note the munged e-mail addy, apologies to those who find it
 a m{*filter*}atrocity .. remove the obvious parts to create the address:
 "soren.newsgroups" AT "wonderstorm" DOT "com" }}



Thu, 04 Mar 2004 21:39:33 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Image::Magick making images from layers

2. Image Magick finding image size without loading image

3. Displaying Image::Magick image objects in Perl/Tk?

4. Need help with Perl::Magick (Image::Magick)

5. Converting images without Image::Magick

6. Image::Magick: find the last image read

7. Merging and splitting of images with Image::Magick

8. convert jpg-images to tiff format with image-magick on winnt

9. Image Magick and returning images to a web page

10. Image::Magick: find the last image read

11. ANNOUNCE: Tutorial # 32: Showcasing Image::Magick (part 2): xml-2-image.pl

12. ANNOUNCE: Tutorial # 31: Showcasing Image::Magick (part 1): text-2-image.pl

 

 
Powered by phpBB® Forum Software