diff options
author | Yorhel <git@yorhel.nl> | 2015-07-18 00:59:40 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2015-07-18 00:59:40 +0200 |
commit | da49b95f180b6fab068bdf88d4d206ca8db2f06b (patch) | |
tree | f476540aa013c73dd35921888e0a904b5b230f2f /lib | |
parent | 26a3a284515d49b834c4de100f418ad91e2b7839 (diff) |
Handler::(VNEdit|Chars): Fix removal of alpha layer in images
Apparently, imagemagick's Flatten() has some odd corner cases where it
seems to do more than just remove the alpha layer. The current approach
is the one recommended by the official docs:
http://www.imagemagick.org/Usage/masking/#remove
Diffstat (limited to 'lib')
-rw-r--r-- | lib/VNDB/Handler/Chars.pm | 3 | ||||
-rw-r--r-- | lib/VNDB/Handler/VNEdit.pm | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/VNDB/Handler/Chars.pm b/lib/VNDB/Handler/Chars.pm index 77d92646..9909f671 100644 --- a/lib/VNDB/Handler/Chars.pm +++ b/lib/VNDB/Handler/Chars.pm @@ -458,7 +458,8 @@ sub _uploadimage { $im->BlobToImage($imgdata); my($ow, $oh) = ($im->Get('width'), $im->Get('height')); my($nw, $nh) = imgsize($ow, $oh, @{$self->{ch_size}}); - $im = $im->Flatten; + $im->Set(background => '#ffffff'); + $im->Set(alpha => 'Remove'); if($ow != $nw || $oh != $nh) { $im->GaussianBlur(geometry => '0.5x0.5'); $im->Resize(width => $nw, height => $nh); diff --git a/lib/VNDB/Handler/VNEdit.pm b/lib/VNDB/Handler/VNEdit.pm index 73201073..8a85b989 100644 --- a/lib/VNDB/Handler/VNEdit.pm +++ b/lib/VNDB/Handler/VNEdit.pm @@ -252,7 +252,8 @@ sub _uploadimage { $im->Set(magick => 'JPEG'); my($ow, $oh) = ($im->Get('width'), $im->Get('height')); my($nw, $nh) = imgsize($ow, $oh, @{$self->{cv_size}}); - $im = $im->Flatten; + $im->Set(background => '#ffffff'); + $im->Set(alpha => 'Remove'); if($ow != $nw || $oh != $nh) { $im->GaussianBlur(geometry => '0.5x0.5'); $im->Resize(width => $nw, height => $nh); |