]> git.sesse.net Git - pr0n/commitdiff
Yet more hacks to get the PNG file size down. This time, drop the alpha
authorSteinar H. Gunderson <sesse@debian.org>
Mon, 26 May 2008 21:14:51 +0000 (23:14 +0200)
committerSteinar H. Gunderson <sesse@debian.org>
Mon, 26 May 2008 21:14:51 +0000 (23:14 +0200)
channel forcibly.

perl/Sesse/pr0n/Common.pm

index c441d679326494f5cfdfd27e4f52e84e8c206130..cc2b660fd3d857370b720d4884c3fba0f8b6c998 100644 (file)
@@ -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 = ();