Gossamer Forum
Home : General : Perl Programming :

[plz HELP me]imagemagick problem, HOW CAN I PRINT a pic in the screen ather i readed it?

Quote Reply
[plz HELP me]imagemagick problem, HOW CAN I PRINT a pic in the screen ather i readed it?
#i read the $path and resize it,:
$image->Read($path);
$image->Resize(width=>$x, height=>400);
#i can write it into a new file:
$image->Write($newpath);

#so how can i just print it in the screen>?? not working>:
print "Content-type: image/$ext\n\n";
print $image
Quote Reply
Re: [Ginkan] [plz HELP me]imagemagick problem, HOW CAN I PRINT a pic in the screen ather i readed it? In reply to
#beside GD, any method can print out a better quality pic?

$im = newFromJpeg GD::Image($path);
print "Content-type: image/pjpeg\n\n";
binmode(STDOUT);
print $im->jpeg(100);
Quote Reply
Re: [Ginkan] [plz HELP me]imagemagick problem, HOW CAN I PRINT a pic in the screen ather i readed it? In reply to
Ginkan wrote:
#i read the $path and resize it,:
$image->Read($path);
$image->Resize(width=>$x, height=>400);
#i can write it into a new file:
$image->Write($newpath);

#so how can i just print it in the screen>?? not working>:
print "Content-type: image/$ext\n\n";
print $image
I think you can read the image back and print it out. like:
...
$image->Write($newpath);
print "Content-type: image/$ext\n\n";
open(IMG,$newpath);
binmode(IMG);
binmode(STDOUT);
print $_ while (<IMG>);
close(IMG);
unlink $newpath;