View Single Post
Old 11-20-2012, 10:58 AM   #1
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 71,506
Karma: 306214458
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Voyage
KindleCover: AppleScript wrapper and Python script application

I like having pretty covers on my Kindle/Mobipocket books. They are displayed by some of my reading devices, and they also show up on my Mac, thanks to my QuickLook plugin.

But changing covers on a Mobipocket/Kindle book isn't easy. At least, it's not easy without doing a conversion in calibre, which also re-works all the text coding and metadata of the book.

Now, I've been playing around with the Kindle/Mobipocket file structure for quite a while (e.g. MobiUnpack) so I decided to write a special purpose cover replacement script. It only replaces the cover image and/or thumbnail image in the file. It changes nothing else.

So, for Mac users, I've also written an AppleScript wrapper. (The python script is embedded, so Mac users only need to download the AppleScript.)

Drag a Kindle/Mobipocket file onto the AppleScript wrapper. A dialog pops up asking you to select an image. Then the new file is created in the same folder as the old file. It's just the same, but with a new cover image, AND a new thumbnail image. The AppleScript creates a 240 pixel thumbnail image from the cover image automatically, and inserts it into the file along with the cover image.


For non-Mac users, the script now includes a tkInter interface, allowing original file, cover image, thumbnail image and output file to be chosen simply.


This script only works with newer Mobipocket files with an EXTH section and metadata identifying the cover and thumbnail images. (All Amazon Kindle Mobipocket format books are like this, and yes, this script does work with the new Amazon KF8/AZW3 format ebooks.)

Amazon recommend that images be below 127KiB (which this script enforces). I'd recommend pixel dimensions of at least 800 tall, and 1024 might be better.

I'd love to get feedback on the AppleScript or the python script.

[Edit: 1.02 now includes a tkInter interface, and works on Windows with files with unicode files names.]
Attached Files
File Type: zip kindlecover.pyw.zip (7.1 KB, 533 views)
File Type: zip KindleCover 1.0.2.app.zip (459.4 KB, 537 views)

Last edited by pdurrant; 11-23-2012 at 06:56 AM.
pdurrant is offline   Reply With Quote