Perl Magick Resize Color Issue

PerlMagick is an object-oriented Perl interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning PerlMagick.
Post Reply
robinshane
Posts: 2
Joined: 2014-01-15T08:11:19-07:00
Authentication code: 6789

Perl Magick Resize Color Issue

Post by robinshane » 2014-01-15T08:13:09-07:00

down vote favorite


I'm writing a script to resize gif images. I've notice that the images I create have a smaller image size, but take up more room on disk. I think I've tracked down the cause of the problem. The original images when examined in photoshop only have 4 colors in their color table (white, gray, grayer, black) while the new images have 256 colors in their color table. I can't find a way to copy the color table from the incoming image, is there some way to control this? Here's my script

Code: Select all

use Image::Magick;
my $image = Image::Magick->new;
$image -> Read( 'test.gif' );
$image -> Resize(geometry=>"50%");
$image->Write( 'test-out.gif' );
Any advice much appreciated.

robinshane
Posts: 2
Joined: 2014-01-15T08:11:19-07:00
Authentication code: 6789

Re: Perl Magick Resize Color Issue

Post by robinshane » 2014-01-15T08:52:49-07:00

Got the suggestion to use Sample instead of Resize, which solves the problem.

Phantom7
Posts: 5
Joined: 2014-02-10T15:31:48-07:00
Authentication code: 6789

Re: Perl Magick Resize Color Issue

Post by Phantom7 » 2014-02-12T04:12:29-07:00

You forgotten to set the Color-Range value! ;)

It seems, that the result use defaults of 255 colors.

Post Reply