ImageMagick and Xitami jpeg/bmp issue
am 28.06.2006 15:40:31 von louloizidesI have ActivePerl and ImageMagick installed on WinXP machine. I'm using
the Xitami webserver. I need to generate thumbnails of a few images on
the fly and I'm using the following code:
---------------------------------------------------
#!c:\perl\bin\perl.exe
use Image::Magick;
use CGI;
my $req = new CGI;
$fileName=$req->param("fileName");
print "Content-type: image/jpeg\r\n\r\n";
$imagefile="C:/pics$fileName";
$image=new Image::Magick( format => "jpeg" );
$image->Set(quality=>10);
$image->Read($imagefile);
$image->Resize(geometry=>'150x150');
binmode STDOUT;
$image->Write('jpg:-');
undef $image;
---------------------------------------------------
It creates the thumbnail fine and the image is obviously a small, poor
quality jpeg because the compression is clearly visible. The problem is
that when I right click on the image and go to save I only get the
option to save it as a bmp. So, because of this, I have no clue whether
the image is being transmitted as a jpeg or bmp. Does anyone know how
I'd be able to tell? If it is being transmitted as a bmp, does anyone
know why? These thumbnails, as jpegs, should be only a few kb each at
the most but the bmps are 40-50kb.