Page 1 of 1

Perl Magick Resize Color Issue

Posted: 2014-01-15T08:13:09-07:00
by robinshane
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.

Re: Perl Magick Resize Color Issue

Posted: 2014-01-15T08:52:49-07:00
by robinshane
Got the suggestion to use Sample instead of Resize, which solves the problem.

Re: Perl Magick Resize Color Issue

Posted: 2014-02-12T04:12:29-07:00
by Phantom7
You forgotten to set the Color-Range value! ;)

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