Image Magick and returning images to a web page 
Author Message
 Image Magick and returning images to a web page
Hi

I have written a Perl 5.0 script that converts an image from one format to a
JPEG format, in order for this to be displayed on a web page.
The HTML code uses the <IMG SRC="engine.cgi"> tag to display the image.  The
perl code uses Image::Magick to do the neccessay conversion however the
returned image is almost garbage.
In Perl script I have used the binmode STDOUT command and written the
$img->write("gif:-") code and yet I still get an almost garbage picture.

Does anybody have any idea what the fault may be???

Thanks

Ian Powell

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ( http://www.*-*-*.com/ ).
Version: 6.0.219 / Virus Database: 103 - Release Date: 05/12/2000



Mon, 14 Jul 2003 06:43:09 GMT  
 Image Magick and returning images to a web page
On Wed, 24 Jan 2001 22:43:09 -0000,

[snip of vague description of problem]

Quote:
> Does anybody have any idea what the fault may be???

Not without the code you use.

Please, provide a small, self-contained script that compiles and runs,
and that displays the problem you see.

Also read the Perl FAQ, section 9 before you submit it,

Martien

--
Martien Verbruggen              |
Interactive Media Division      | The four hor{*filter*} of the apocalypse
Commercial Dynamics Pty. Ltd.   | are called Abort, Retry, Ignore and
NSW, Australia                  | Fail.



Mon, 14 Jul 2003 09:45:35 GMT  
 Image Magick and returning images to a web page
Perl 5 code :-

#!perl
use Image::Magick;
use CGI;
my $img = new Image::Magick; # Create a new Image::Magick object
my $response = new CGI;      # Create a new CGI object
$x = $img->Read('f:/test.jpg');      # Read in our image all the pages
binmode STDOUT;
print $response->header(-type=>'image/jpeg');
$img->Write('jpeg:-');
undef $img; # Destroy the file in memory

HTML code
<html>
<head>
<title> </title>
</head>
<body>
<p>This is page 3</p>
<p><img src="http://boss/cgi-bin/engine2.cgi"></p>
</body>
</html>

On  running this script the JPEG file is returned as garbage.

Sorry I forgot Martien but this should show my problem........

Ian Powell


Quote:
> On Wed, 24 Jan 2001 22:43:09 -0000,

> [snip of vague description of problem]

> > Does anybody have any idea what the fault may be???

> Not without the code you use.

> Please, provide a small, self-contained script that compiles and runs,
> and that displays the problem you see.

> Also read the Perl FAQ, section 9 before you submit it,

> Martien

> --
> Martien Verbruggen              |
> Interactive Media Division      | The four hor{*filter*} of the apocalypse
> Commercial Dynamics Pty. Ltd.   | are called Abort, Retry, Ignore and
> NSW, Australia                  | Fail.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ( http://www.*-*-*.com/ ).
Version: 6.0.219 / Virus Database: 103 - Release Date: 05/12/2000


Mon, 14 Jul 2003 15:11:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Image Magick finding image size without loading image

2. Converting images without Image::Magick

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

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

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

6. AS Perl 629 Image::Magick makes Perl crash when outputting image to file

7. Image::Magick making images from layers

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

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

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

11. CGI image generation using Image::Magick

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

 

 
Powered by phpBB® Forum Software