Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Converting images without Image::Magick

Reply
Thread Tools

Converting images without Image::Magick

 
 
Jason Carlton
Guest
Posts: n/a
 
      11-17-2009
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?
 
Reply With Quote
 
 
 
 
Oliver 'ojo' Bedford
Guest
Posts: n/a
 
      11-17-2009
Am Tue, 17 Nov 2009 00:39:01 -0800 schrieb Jason Carlton:

> 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?


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)

Oliver
 
Reply With Quote
 
 
 
 
Jason Carlton
Guest
Posts: n/a
 
      11-17-2009
On Nov 17, 4:15*am, Oliver 'ojo' Bedford <(E-Mail Removed)> wrote:
> Am Tue, 17 Nov 2009 00:39:01 -0800 schrieb Jason Carlton:
>
> > 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?

>
> * 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)
>
> * Oliver


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
converting.

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=300, height proportionate
$resize_pic = $image->scale(xpixels=>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
original
# image on the server, so it needs to be deleted
if (lc($ext) ne "jpg") { unlink("$path/$filename.$ext"); }
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Images don't show after converting web app from VS2003 to VS2005 =?Utf-8?B?VGFtbWFt?= ASP .Net 2 07-29-2006 01:02 AM
Converting images to binary files =?Utf-8?B?QmVnaW5uZXI=?= ASP .Net 4 05-22-2006 06:18 PM
Converting Images =?Utf-8?B?QmVnaW5uZXI=?= ASP .Net 1 04-28-2006 06:12 PM
Converting images to text Atlas Shrugged Computer Support 4 02-14-2005 06:25 PM
Tool for converting 12-bit TIFF images to 16-bit TIFF-images? Peter Frank Digital Photography 11 12-13-2004 02:41 AM



Advertisments