$image->Coalesce(); isn't doing anything
Posted: 2019-03-25T03:50:02-07:00
I used this command to turn animated gifs into spritesheets that fit into a 24x24 square. I got tired of doing this, so I've decided to automate my workflow and put it into a Perl script. However, I cannot, for the life of me, get the coalesce function to work in Perl. My code is as follows:
The dimensions are correct, but when anim.gif is optimized, transparent holes show up all over the spritesheet, rendering it unusable. I am fairly sure that the problem lies within the coalesce function, as that is what it is supposed to prevent.
Code: Select all
convert anim.gif -coalesce -resize 24x24 +append anim.png
Code: Select all
my $image = Image::Magick->new(background=>"rgba(0, 0, 0, 0.0)", alpha=>"On");
$image->Read("anim.gif");
$image->Coalesce();
$image->Resize(geometry=>"24x24");
$image->Append(stack=>0);
$image->Write(format=>"png", filename=>"anim.png");
undef $image;