Skip to content
A script for getting cover images from ebooks in the .mobi format
Branch: development
Clone or download


This is a Python script that gets the cover image from ebooks in the .mobi format.

An arrow from a blank document to a yellowing book cover

Book cover: Captain Billy's Whiz Bang, from Project Gutenberg.


I have an app (alexwlchan/docstore) that I used to manage my scanned documents and my ebook collection. To help me spot files quickly (and because it looks nice!), I create thumbnails of every document I store.

I've got a handful of MOBI files for my Kindle, but I didn't have a way to get a cover image from MOBI files.

The app doesn't care about the ebook contents, just the cover image. I didn't need a full-blown MOBI parser, as long as I can get a thumbnail. What I wanted was a single-purpose tool that takes a MOBI file, and extracts the cover image.

I couldn't find an existing tool to do that, but I did find some code that does the hard work of parsing a MOBI file -- this script ties it all together into that single-purpose tool.

It's a standalone tool because all the MOBI parsing code I found is GPL-licensed. By making it a separate script I can shell out to, the GPL license is contained to the thin wrapper script.


Clone or download this repository:

$ git clone

You also need to install Python. I've tested the script with Python 2.7 and 3.6.


Run the script, passing the path to the MOBI file you want a thumbnail for. It saves the thumbnail to the current directory, and prints the name of the thumbnail file:

$ python

The image is saved directly as it's stored in the MOBI file -- same format, same bytes, no compression or interference.

Technical details

Most of the heavy lifting is done by other people's code, which is included in this repo:

  • is from KindleButler by Paweł Jastrzębski. Used under GPL-3.

  • by K. Hendricks. Used under GPL-3.

  • by M. Hannum, P. Durrant, K. Hendricks, S. Siebert, fandrieu, DiapDealer, nickredding. Used under GPL-3.

I made a couple of changes to, in particular:

  • Removing a dependency on the Pillow imaging library
  • Return the original image data, rather than a downsized/greyscale version


GPL v3.

You can’t perform that action at this time.