Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle

Notices

Reply
 
Thread Tools Search this Thread
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: 30,787
Karma: 85457880
Join Date: Jul 2007
Location: Norfolk, England
Device: NOOK ST GlowLight
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, 112 views)
File Type: zip KindleCover 1.0.2.app.zip (459.4 KB, 123 views)

Last edited by pdurrant; 11-23-2012 at 06:56 AM.
pdurrant is online now   Reply With Quote
Old 11-21-2012, 05:40 PM   #2
alansplace
Wizard
alansplace ought to be getting tired of karma fortunes by now.alansplace ought to be getting tired of karma fortunes by now.alansplace ought to be getting tired of karma fortunes by now.alansplace ought to be getting tired of karma fortunes by now.alansplace ought to be getting tired of karma fortunes by now.alansplace ought to be getting tired of karma fortunes by now.alansplace ought to be getting tired of karma fortunes by now.alansplace ought to be getting tired of karma fortunes by now.alansplace ought to be getting tired of karma fortunes by now.alansplace ought to be getting tired of karma fortunes by now.alansplace ought to be getting tired of karma fortunes by now.
 
alansplace's Avatar
 
Posts: 3,632
Karma: 18305540
Join Date: Feb 2010
Location: USA, 33.938556° N, -117.271334° W
Device: Kindle 2, Kindle KB, Kindle PW 1 & 2, Kindle Fire 2nd Gen
Cool hmmm...

Nice, a cool enhancement to the windows version would be a windows interface for inputting the values needed (a .pyw I think?).

Also, I never knew that a mobi had an imbedded thumbnail. What do you get if you don't give it a new thumbhail. My test mobi looked perfectly normal in Kindlepreviewer and I just omitted the -t switch from the command line when I tested it? What size should the thumbnail be?

Will this be included in future tools updates?


Last edited by alansplace; 11-21-2012 at 05:42 PM.
alansplace is online now   Reply With Quote
Old 11-21-2012, 06:14 PM   #3
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: 30,787
Karma: 85457880
Join Date: Jul 2007
Location: Norfolk, England
Device: NOOK ST GlowLight
Quote:
Originally Posted by alansplace View Post
Nice, a cool enhancement to the windows version would be a windows interface for inputting the values needed (a .pyw I think?).

Also, I never knew that a mobi had an imbedded thumbnail. What do you get if you don't give it a new thumbhail. My test mobi looked perfectly normal in Kindlepreviewer and I just omitted the -t switch from the command line when I tested it? What size should the thumbnail be?

Will this be included in future tools updates?
Alf is welcome to include it in the tools, but since it doesn't affect DRM (& isn't affected by DRM*) it can be hosted here at mobileread.

I suspect that most modern Mobipocket readers ignore the thumbnail image. It 'ought' to have a maximum dimension of 240 pixels.

Yes, it would be possible to add a tk interface to the script, but I don't have much incentive, since I much prefer using my Mac. But if someone else wants to have ago, that would be great. [EDIT: I added one in version 1.0.2]

I suppose it would be possible to add in (some of) the Python Imaging Library and have the thumbnail generation done by the python script, making it easier to use cross-platform.

And for that manner, some sanity-checking of the cover image dimensions and file size would be beneficial.

Perhaps others will be inspired to contribute.


*That is, it's possible to replace the cover on a DRMed Kindle/Mobipocket file without first stripping the DRM, and the DRMed file will work fine afterwards with the device it's intended for.

Last edited by pdurrant; 02-09-2013 at 11:24 AM.
pdurrant is online now   Reply With Quote
Old 11-21-2012, 07:17 PM   #4
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 4,597
Karma: 4440239
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW & PW2
AFAIK, the embedded thumbnail is only used (at least, I'm not familiar with K 4 iOS/Android/PC/OSX) on the Touch/PW in Cover View mode, and even then, in some very specific cases only:

* On the Touch (with JBPatch): When the ASIN (exth 113) is unset or invalid (an UUID).
* On the PW: When the ASIN (exth 113) is unset.

Otherwise, the firmware falls back to the sideloaded thumbnail (or downloads it from Amazon if the ASIN is valid).

(And, yeah, 240x240 seems to be the 'standard', at least that's what both KG & Calibre do. Fun detail: It's actually a tiny bit too small for the PW screen, making those easy to spot).

Last edited by NiLuJe; 11-21-2012 at 07:23 PM.
NiLuJe is offline   Reply With Quote
Old 11-23-2012, 06:58 AM   #5
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: 30,787
Karma: 85457880
Join Date: Jul 2007
Location: Norfolk, England
Device: NOOK ST GlowLight
Just updated to 1.0.2.

Fixed problems with unicode files names on Windows.
Added a tkInter interface.
Sanity-check of image files sizes is now 127KiB as Amazon recommend.
Image file types now restricted to GIF and JPEG as Amazon recommend.
pdurrant is online now   Reply With Quote
Old 12-02-2012, 05:50 AM   #6
Fluribus
Guru
Fluribus ought to be getting tired of karma fortunes by now.Fluribus ought to be getting tired of karma fortunes by now.Fluribus ought to be getting tired of karma fortunes by now.Fluribus ought to be getting tired of karma fortunes by now.Fluribus ought to be getting tired of karma fortunes by now.Fluribus ought to be getting tired of karma fortunes by now.Fluribus ought to be getting tired of karma fortunes by now.Fluribus ought to be getting tired of karma fortunes by now.Fluribus ought to be getting tired of karma fortunes by now.Fluribus ought to be getting tired of karma fortunes by now.Fluribus ought to be getting tired of karma fortunes by now.
 
Posts: 602
Karma: 5818980
Join Date: Feb 2012
Device: Kindle
The python script seems to work quite well with Python 2.7.3. It didn't work with 3.3.0.

I wish that Kindle files were as easy to tweak as EPUB rather than hermetically sealed and kept in mayonnaise jars on Funk & Wagnalls porch. (I don't know if Johnny Carson was ever broadcast outside the US. I thought about doing a Monty Python joke but decided to do something completely different.)
Fluribus is offline   Reply With Quote
Old 12-02-2012, 07:14 AM   #7
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: 30,787
Karma: 85457880
Join Date: Jul 2007
Location: Norfolk, England
Device: NOOK ST GlowLight
Quote:
Originally Posted by Fluribus View Post
The python script seems to work quite well with Python 2.7.3. It didn't work with 3.3.0.
Yes, it's written for python 2.5 and later. While Python 3 is certainly the python of the future, the python of the present seems to be 2.x
pdurrant is online now   Reply With Quote
Reply

Tags
kindle tools, mobi2mobi

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Kindlestrip Python script and AppleScript wrapper pdurrant Kindle Formats 133 07-11-2014 07:18 AM
Applescript Wrapper Application for Kindlegen pdurrant Kindle Formats 20 07-09-2014 05:29 PM
ePub Zip/Unzip AppleScript application for Mac OS X pdurrant ePub 91 04-02-2014 03:02 PM
KindleNamer: Kindle/Mobi File Naming AppleScript/Python Script pdurrant Kindle Formats 1 11-22-2012 06:23 AM
Nedd a little help with a python script gandor62 Calibre 1 08-07-2008 09:59 PM


All times are GMT -4. The time now is 09:44 AM.


MobileRead.com is a privately owned, operated and funded community.