EBook::MOBI::Image - Make sure that pictures cope with the MOBI standards.
This module was separated from the main code to reduce dependencies. If you need to process images in your ebook data, just install this module additionally to EBook::MOBI (from v0.56 or higher) and it should work.
EBook::MOBI
v0.56
This example is for developers only. Normal users just need to install this module, EBook::MOBI will detect automatically that the module is there and use it. See EBook::MOBI for how to actually add images!
use EBook::MOBI::Image; my $p = EBook::MOBI::Image->new(); my $img_path_small = $p->rescale_dimensions($img_path_big);
The code is meant to be used in object oriented style, so you are asked to create an object before using.
my $p = EBook::MOBI::Image->new();
According to my own research at the web, it is a good idea to have a maximum size for images of 520 x 622. And this is what this method does, it ensures that this maximum is kept.
Pass a path to an image as the first argument, you will then get back the path of a rescaled image. The image is only rescaled if necessary. The image is a temporary copy (to protect the original) and will be deleted after your code exits.
Attention: All pictures, no matter what size will be converted to JPG. In my tests, the Kindle-Reader failed to display PNG, that is why I convert everything - to go safe.
You can just ignore this method if you are not interested in debuging!
Pass a reference to a debug subroutine and enable debug messages.
Stop debug messages and erease the reference to the subroutine.
A method to change the maximum values would be nice.
A development version of Imlib2 (non-perl) must be installed locally before installing this module.
Imlib2
Copyright 2013 Boris Däppen, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms of Artistic License 2.0.
Boris Däppen <boris_daeppen@bluewin.ch>
To install EBook::MOBI::Image, copy and paste the appropriate command in to your terminal.
cpanm
cpanm EBook::MOBI::Image
CPAN shell
perl -MCPAN -e shell install EBook::MOBI::Image
For more information on module installation, please visit the detailed CPAN module installation guide.