The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.


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.


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.


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 <>