X-Git-Url: https://git.sesse.net/?p=pr0n;a=blobdiff_plain;f=perl%2FSesse%2Fpr0n%2FCommon.pm;h=6f45d55d903186aa6dc489f208519fd98574887f;hp=c441d679326494f5cfdfd27e4f52e84e8c206130;hb=2a98fc654ff4ec29aa576ac5ba68fcba08682ef3;hpb=7692cd97b7c64a41f77a6c4b745248ad76670d42 diff --git a/perl/Sesse/pr0n/Common.pm b/perl/Sesse/pr0n/Common.pm index c441d67..6f45d55 100644 --- a/perl/Sesse/pr0n/Common.pm +++ b/perl/Sesse/pr0n/Common.pm @@ -35,7 +35,7 @@ BEGIN { require Sesse::pr0n::Config_local; }; - $VERSION = "v2.60"; + $VERSION = "v2.65"; @ISA = qw(Exporter); @EXPORT = qw(&error &dberror); %EXPORT_TAGS = qw(); @@ -408,7 +408,7 @@ sub make_mipmap { my $large_enough = 1; for my $i (0..($#res/2)) { my ($xres, $yres) = ($res[$i*2], $res[$i*2+1]); - if ($xres > $new_mmwidth || $yres > $new_mmheight) { + if ($xres == -1 || $xres > $new_mmwidth || $yres > $new_mmheight) { $large_enough = 0; last; } @@ -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 = ();