|
|
#1 |
|
The Grand Mouse
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,262
Karma: 73595938
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle 2; iPhone 3G; Bookeen Opus; NOOK ST GlowLight
|
KindleCover: AppleScript wrapper and Python script application
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.]
__________________
Kai Lung Raises His Voice, now available at Amazon and BooksOnBoard A new collection of ‘Kai Lung’ stories by Ernest Bramah, including four previously unpublished stories. Need professional help formatting your ebook? Send me email.....................Books I've read in 2013, 2012, 2011, 2010 Last edited by pdurrant; 11-23-2012 at 06:56 AM. |
|
|
|
|
|
#2 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,567
Karma: 6595408
Join Date: Feb 2010
Location: USA, 33.938556° N, -117.271334° W
Device: Kindle 2, Kindle Keyboard, Kindle Fire 2nd Gen, & Kindle PaperWhite
|
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. |
|
|
|
|
Enthusiast
|
|
|
|
#3 | |
|
The Grand Mouse
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,262
Karma: 73595938
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle 2; iPhone 3G; Bookeen Opus; NOOK ST GlowLight
|
Quote:
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.
__________________
Kai Lung Raises His Voice, now available at Amazon and BooksOnBoard A new collection of ‘Kai Lung’ stories by Ernest Bramah, including four previously unpublished stories. Need professional help formatting your ebook? Send me email.....................Books I've read in 2013, 2012, 2011, 2010 Last edited by pdurrant; 02-09-2013 at 11:24 AM. |
|
|
|
|
|
|
#4 |
|
BLAM!
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,895
Karma: 2267781
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w & PW
|
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. |
|
|
|
|
|
#5 |
|
The Grand Mouse
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,262
Karma: 73595938
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle 2; iPhone 3G; Bookeen Opus; 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.
__________________
Kai Lung Raises His Voice, now available at Amazon and BooksOnBoard A new collection of ‘Kai Lung’ stories by Ernest Bramah, including four previously unpublished stories. Need professional help formatting your ebook? Send me email.....................Books I've read in 2013, 2012, 2011, 2010 |
|
|
|
|
|
#6 |
|
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 391
Karma: 4316614
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.)
__________________
As the Russians say, yawn is nigh you. A sleepy bunch, those Russians. |
|
|
|
|
|
#7 |
|
The Grand Mouse
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,262
Karma: 73595938
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle 2; iPhone 3G; Bookeen Opus; NOOK ST GlowLight
|
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
__________________
Kai Lung Raises His Voice, now available at Amazon and BooksOnBoard A new collection of ‘Kai Lung’ stories by Ernest Bramah, including four previously unpublished stories. Need professional help formatting your ebook? Send me email.....................Books I've read in 2013, 2012, 2011, 2010 |
|
|
|
![]() |
| Tags |
| kindle tools, mobi2mobi |
| Thread Tools | Search this Thread |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Kindlestrip Python script and AppleScript wrapper | pdurrant | Mobi | 79 | 04-20-2013 07:51 AM |
| Applescript Wrapper Application for Kindlegen | pdurrant | Mobi | 13 | 03-14-2013 02:07 PM |
| KindleNamer: Kindle/Mobi File Naming AppleScript/Python Script | pdurrant | Mobi | 1 | 11-22-2012 06:23 AM |
| ePub Zip/Unzip AppleScript application for Mac OS X | pdurrant | ePub | 68 | 11-02-2012 08:39 AM |
| Nedd a little help with a python script | gandor62 | Calibre | 1 | 08-07-2008 09:59 PM |