Subject: | Imlib2 save bug |
Date: | Wed, 27 Dec 2017 16:41:24 +0000 |
To: | "bug-EBook-MOBI-Image [...] rt.cpan.org" <bug-EBook-MOBI-Image [...] rt.cpan.org> |
From: | Andreas Zöllner <andi [...] go-for-fun.de> |
Hi,
I found a problem with Ebook::MOBI::Image: Imlib2 isn't saving images that don't need resizing on macOS Sierra. I resolved this by adding the following lines to Image.pm:
# If the file is below max width/height we dont to anything
# NOPE: We do convert to JPG, because PNG fails on Kindle
else {
$self->_debug(
"Image $image_path is of size $width"."x$height - no resizing."
);
print "Resolving save bug \n";
my $resized = $image->create_scaled_image($width-1, 0);
# BUG: Seems like Kindle Reader can't display PNG in my tests...
# SO I CONVERT EVERYTHING TO JPEG
$resized->save($outfilename);
# this is so that return returns the right value
$image_path = $outfilename;
}
Maybe you want to put this into your code base as well.
Regards
Andreas