From: Steinar H. Gunderson Date: Mon, 26 May 2008 21:14:51 +0000 (+0200) Subject: Yet more hacks to get the PNG file size down. This time, drop the alpha X-Git-Url: https://git.sesse.net/?p=pr0n;a=commitdiff_plain;h=a48970df0c4bf4d7d106bfa77149c5774e696ff4 Yet more hacks to get the PNG file size down. This time, drop the alpha channel forcibly. --- diff --git a/perl/Sesse/pr0n/Common.pm b/perl/Sesse/pr0n/Common.pm index c441d67..cc2b660 100644 --- a/perl/Sesse/pr0n/Common.pm +++ b/perl/Sesse/pr0n/Common.pm @@ -576,6 +576,11 @@ sub ensure_cached { my $info = Image::ExifTool::ImageInfo($fname); if (make_infobox($img, $info, $r)) { $img->Quantize(colors=>16, dither=>'False'); + + # Since the image is grayscale, ImageMagick overrides us and writes this + # as grayscale anyway, but at least we get rid of the alpha channel this + # way. + $img->Set(type=>'Palette'); } else { # Not enough room for the text, make a tiny dummy transparent infobox @$img = ();