メモ
アルファチャンネルを適用する。$img->convert(preset => 'noalpha')
だとなんかアルファを削除してるだけみたいな感じだった。
use Imager; use Imager::Color; use Imager::Fill; my $img = Imager->new or die; $img->read(file => $src) or die $img->errstr; if ($img->getchannel == 4) { my $copy = $img->copy or die $img->errstr; my $color = Imager::Color->new(255, 255, 255) or die; my $fill = Imager::Fill->new(solid => $color, combine => 'none') or die; $img->box(fill => $fill) or die $img->errstr; $img = $img->rubthrough(src => $copy) or die $img->errstr; } $img->write(file => $dest) or die $img->errstr;