summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2015-07-01 18:47:44 +0200
committerYorhel <git@yorhel.nl>2015-07-01 18:47:44 +0200
commit2f61c4f6772f852f9e0b9ede6228de4e4dbf71a0 (patch)
tree7d9a42cabfac0b9c43b48ae984ac3aec4b687e7f
parentde591a7241c5acd2fb115ec85eeccb55592c51a5 (diff)
Handler::Chars: Use better image resizing algorithm
As suggested at https://vndb.org/t6668.18 I also like how the 'amount' option isn't documented for UnsharpMask(). All documentation says 'gain' instead, but that option throws an error.
-rw-r--r--lib/VNDB/Handler/Chars.pm6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/VNDB/Handler/Chars.pm b/lib/VNDB/Handler/Chars.pm
index 3c2c2c0a..77d92646 100644
--- a/lib/VNDB/Handler/Chars.pm
+++ b/lib/VNDB/Handler/Chars.pm
@@ -458,8 +458,12 @@ sub _uploadimage {
$im->BlobToImage($imgdata);
my($ow, $oh) = ($im->Get('width'), $im->Get('height'));
my($nw, $nh) = imgsize($ow, $oh, @{$self->{ch_size}});
- $im->Thumbnail(width => $nw, height => $nh);
$im = $im->Flatten;
+ if($ow != $nw || $oh != $nh) {
+ $im->GaussianBlur(geometry => '0.5x0.5');
+ $im->Resize(width => $nw, height => $nh);
+ $im->UnsharpMask(radius => 0, sigma => 0.75, amount => 0.75, threshold => 0.008);
+ }
$im->Set(magick => 'JPEG', quality => 90);
# Get ID and save