Converting images without Image::Magick

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Like so many others, I can't get Image::Magick to install on my
server. I found where someone had posted (in 2007) that you can first
install graphviz RPM, then the module IPC-Run, then the module
GraphViz, and THEN you might be able to install Image::Magick, but
that's a lot of work if there's an easier way around my problem.

All that I'm using it for is to convert BMP, GIF, and PNG files to
JPG. Is there another way to do this? I've been using Imager; I don't
suppose that you can convert an image with that module, can you?

Re: Converting images without Image::Magick

Am Tue, 17 Nov 2009 00:39:01 -0800 schrieb Jason Carlton:

Quoted text here. Click to load it

  From the man page Imager::Files:
      The "type" parameter is a lowercase representation of the file type,
       and can be any of the following:

         bmp   Windows BitMaP (BMP)
         gif   Graphics Interchange Format (GIF)
         jpeg  JPEG/JFIF
         png   Portable Network Graphics (PNG)
         pnm   Portable aNyMap (PNM)
         raw   Raw
         sgi   SGI .rgb files
         tga   TARGA
         tiff  Tagged Image File Format (TIFF)


Re: Converting images without Image::Magick

Quoted text here. Click to load it

I had read that, but just thought it meant that these were the file
types that it would recognize. I didn't see it say anything about

Can I simply do this:

use Imager;

$path = "/home/mydomain/www/images"
$pic = "leapord.bmp";

my $image = Imager->new;

# Read original $pic
$image->read(file => "$path/$pic");

# Resize to width=3D300, height proportionate
$resize_pic = $image->scale(xpixels=3D>300, qtype => 'mixing');

# Write as .jpg
$resize_pic->write(file => "$path/$filename.jpg");

# I'm assuming that writing it with a different name will leave the
# image on the server, so it needs to be deleted
if (lc($ext) ne "jpg") { unlink("$path/$filename.$ext"); }

Re: Converting images without Image::Magick

Quoted text here. Click to load it

What happened when you tried it?

(Or indeed, what does the first example in perldoc Imager look like?)


Site Timeline