(none) imager-devel
/ help / lists / applications / search /
 

Re: Resizing .gif Graphics

From: Greg Krieser (
14907@xyz.molar.is)
Date: Wed 07 Sep 2005 - 01:25:51 GMT

  • Next message: Tony Cook: "Re: Resizing .gif Graphics"

    Hi Tony,
     
    Thanks for your prompt response! I have found the problem. Here are the formats that came back:
     
    bmp
    raw
    pnm
    tga
    jpeg
    rgb

    How difficult will it be for my shared hosting provider to add gif? I don't believe I have access to change this module installation.
     
    Thank You,
     
    Greg

    Tony Cook <14944@xyz.molar.is> wrote:
    On Tue, Sep 06, 2005 at 05:32:20PM -0700, Greg Krieser wrote:
    > Is it possible to resize .gif files just like .jpg files? I've used .jpg resizing without any trouble, but using the same approach with .gif does not work (no error messages, just no results). Any suggestions?
    >
    > $img=Imager->new();
    > $img->open(file=>'/path_to.gif',type=>'gif') || print "failed: ",$img->{ERRSTR},"\n";
    > $width=$img->getwidth();
    > if ($width > 250) {
    > $scaled=$img->scale(xpixels=>250);
    > $scaled->write(file=>'/path_to_resized.gif',type=>'gif') || print "failed: ",$scaled->{ERRSTR},"\n";
    >
    > Thank You,

    Do you get an empty file, or no file at all?

    Does your installed Imager have GIF configured? To test this run:

    perl -MImager -le 'print for keys %Imager::formats'

    and see if gif is listed.

    I ran the following script:

    #!perl -w
    use strict;
    use Imager;

    my $in = shift;
    my $out = shift
    or die "Usage: $0 input output\n";
    my $img = Imager->new;
    $img->read(file=>$in)
    or die "Cannot read $in: ",$img->errstr,"\n";
    my $scaled = $img->scale(xpixels=>100);
    $scaled->write(file=>$out, type=>'gif')
    or die "Cannot write $out: ",$scaled->errstr,"\n";

    which produced a resized GIF image when I tested it.

    -- 
    Tony
    

    Attachments: + http://www.molar.is/en/lists/imager-devel/2005-09/1e4217c3/01.unnamed.html



  •