Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > Kindle Formats

Notices

Reply
 
Thread Tools Search this Thread
Old 12-13-2010, 07:10 AM   #1
garygibsonsf
Addict
garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.
 
Posts: 321
Karma: 432192
Join Date: Dec 2007
Location: Glasgow, Scotland
Device: Amazon Kindle Paperwhite
Maintaining layout in mobi books after de-drming them.

I just got a Kindle recently and purchased an ebook with no cover, which irritates me like hell. After jailbreaking it, I added in a cover through Calibre, while simultaneously (and necessarily) converting it from AZW to mobi format. However, I find I lose a lot of the formatting. Any idea if there's a particular way I should set Calibre up to avoid this? I've had a look at the calibre help guide but, to be honest, I'm a bit confused, so I'm hoping someone here might be able to tell me if there's any simple and easy way to stop the formatting/font size/indents/spacing etc from changing from the original Kindle file.
garygibsonsf is offline   Reply With Quote
Old 12-13-2010, 07:20 AM   #2
ATDrake
Wizzard
ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.
 
Posts: 11,517
Karma: 33048258
Join Date: Mar 2010
Location: Roundworld
Device: Kindle 2 International, Sony PRS-T1, BlackBerry PlayBook, Acer Iconia
Personally, I think you'd be better off using Mobiunpack to extract the HTML (it preserves the original formatting along with any opf and ncx info for chapter marks and start points and such), editing the opf to add in your cover image, and generating a new Mobi via KindleGen or similar. It takes only a couple of minutes and I find it's much simpler that way.

Mind you, there might be an easier way to do it via Calibre, though perhaps you'd get a better response asking in that forum.
ATDrake is offline   Reply With Quote
Advert
Old 12-13-2010, 08:13 AM   #3
garygibsonsf
Addict
garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.
 
Posts: 321
Karma: 432192
Join Date: Dec 2007
Location: Glasgow, Scotland
Device: Amazon Kindle Paperwhite
Quote:
Originally Posted by ATDrake View Post
Personally, I think you'd be better off using Mobiunpack to extract the HTML (it preserves the original formatting along with any opf and ncx info for chapter marks and start points and such), editing the opf to add in your cover image, and generating a new Mobi via KindleGen or similar. It takes only a couple of minutes and I find it's much simpler that way.

Mind you, there might be an easier way to do it via Calibre, though perhaps you'd get a better response asking in that forum.
Thanks, I'll try that out.
garygibsonsf is offline   Reply With Quote
Old 12-13-2010, 08:39 AM   #4
garygibsonsf
Addict
garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.
 
Posts: 321
Karma: 432192
Join Date: Dec 2007
Location: Glasgow, Scotland
Device: Amazon Kindle Paperwhite
AT - I gave that a try, and it works fine, except there is no .opf file generated, and Kindlegen doesn't seem to show an option for either generating one (I think) or other way to include an image file. Does that mean Calibre is my only option?
garygibsonsf is offline   Reply With Quote
Old 12-13-2010, 09:22 AM   #5
ATDrake
Wizzard
ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.
 
Posts: 11,517
Karma: 33048258
Join Date: Mar 2010
Location: Roundworld
Device: Kindle 2 International, Sony PRS-T1, BlackBerry PlayBook, Acer Iconia
Huh. Normally Mobiunpack creates one with the same filename as the extracted html + .opf extension if the info is available, but maybe the book you're trying it on just has poor metadata.

ETA 2: I think your problem may be linked to the version of the script you could be using. Don't use the original version posted in the OP, but scroll down to pdurrant's modified version in post #5. That's the one that outputs the .opf and any pre-existing images, which you can then swap out.

In any case, you can just copy/paste this to give yourself a rudimentary OPF to point KindleGen at:

Code:
<?xml version="1.0" encoding="utf-8"?>
<package unique-identifier="uid">
<metadata>
<dc-metadata xmlns:dc="http://purl.org/metadata/dublin_core" xmlns:oebpackage="http://openebook.org/namespaces/oeb-package/1.0/">
<dc:Title>BOOK TITLE HERE</dc:Title>
<dc:Language>en</dc:Language>
<dc:Identifier id="uid">JUST MAKE UP A NUMBER</dc:Identifier>
<dc:Creator>AUTHOR LASTNAME, FIRSTAME; COAUTHOR LAST, FIRST</dc:Creator>
</dc-metadata>
<x-metadata>
<output encoding="utf-8">
</output>
<EmbeddedCover>RELATIVE FILE LOCATION OF YOUR IMAGE/IMAGE.JPEG</EmbeddedCover>
</x-metadata>
</metadata>
<manifest>
<item id="item1" media-type="text/x-oeb1-document" href="LOCATIONOFYOUR.HTML"></item>
</manifest>
<spine>
<itemref idref="item1"/>
</spine>
<tours>
</tours>
<guide>
<reference title="Table of Contents" type="toc" href="LOCATIONOFYOUR.HTML#filepos740" />
<reference title="Start Here" type="start" href="LOCATIONOFYOUR.HTML#filepos2751" />
</guide>
</package>
This is directly extracted from a Mobi I just made from a cleaned-up Fictionwise book I reassembled.

For the #filepos bits, you'll have to dig into your extracted HTML and find the corresponding numbers for the parts just in front of the Table of Contents (if it exists) and where you want the book to start (dedication, prologue, etc.).

If there aren't any such places, just edit out those <reference> items entirely.

Then do kindlegen -c2 NAMEOF.OPF -o NAMEOFDESIRED.MOBI. You may want to add a -verbose and a -unicode for both troubleshooting and extra character support. -c2 gives you the tightest compression, though to cut down on bloat you may also want to run the KindleStrip script on it afterwards.

Hope this helps.

ETA: There's always the option of using MobiPerl, which apparently has a handy GUI version for Windows users, too.

It can do a lot of things faster and easier and less intrusively to the output file than Calibre. I often use it to fix metadata on existing files I don't want to otherwise tweak.

ETA 3: And it just occurred to me that you could probably use it to add/change the cover image and nothing else without having to go through all this dissasembly/reassembly stuff.

Last edited by ATDrake; 12-13-2010 at 09:48 AM. Reason: Add MobiPerl links. Realized what the problem might be. D'oh!
ATDrake is offline   Reply With Quote
Advert
Old 12-13-2010, 03:25 PM   #6
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,713
Karma: 5703586
Join Date: Nov 2009
Device: many
Quote:
Originally Posted by ATDrake View Post
Huh. Normally Mobiunpack creates one with the same filename as the extracted html + .opf extension if the info is available, but maybe the book you're trying it on just has poor metadata.

ETA 2: I think your problem may be linked to the version of the script you could be using. Don't use the original version posted in the OP, but scroll down to pdurrant's modified version in post #5. That's the one that outputs the .opf and any pre-existing images, which you can then swap out.
FYI: Paul and I set up a google code account to keep MobiUnpack.pyw and other related tools that are open source and free and only work on non-drm ebooks (so no laws being broken!).

You can get the latest version of MobiUnpack from:

http://code.google.com/p/ebook-conve...downloads/list

Just gab the zip archive and unzip it. You will find the gui version of the MobiUnpack.pyw tool. It will create an .opf file when unpacking a non-drm mobi file.
KevinH is online now   Reply With Quote
Old 12-13-2010, 03:59 PM   #7
ATDrake
Wizzard
ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.
 
Posts: 11,517
Karma: 33048258
Join Date: Mar 2010
Location: Roundworld
Device: Kindle 2 International, Sony PRS-T1, BlackBerry PlayBook, Acer Iconia
Awesomeness. And the PML tool even has an option for putting in chapter breaks.

Bookmarked, thank you!
ATDrake is offline   Reply With Quote
Old 12-16-2010, 11:14 AM   #8
garygibsonsf
Addict
garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.garygibsonsf ought to be getting tired of karma fortunes by now.
 
Posts: 321
Karma: 432192
Join Date: Dec 2007
Location: Glasgow, Scotland
Device: Amazon Kindle Paperwhite
Hey AT - I'll have to admit I did rather struggle to make all this work. Your advice is excellent, unfortunately, although I have some familiarity with things like HTML, I'm a no-brainer when it comes to stuff on this level. I did follow your suggestions as closely as I could, but unfortunately they didn't pan out for me. Thank you, though, for taking the time to help me out.

What did work, however, was converting the cover-less books to Epub format in Calibre, having first included a cover image in the Metadata via Calibre's menu system.

Instead of then converting the Epub back to Mobi in Calibre - which always produces terrible formatting issues - I instead navigated to the newly generated Epub file, and ran it through Kindlegen. This produced a perfectly formatted Mobi book, complete with cover. I'm guessing Kindlegen somehow strips out all the problematic formatting caused by Calibre. It works, anyway, and might be a little easier for people like myself who get a bit list in command-line land.

Just to sum up for anyone else reading it with the same question in mind - add mobi book to Calibre, use Calibre to add a cover image, then use Calibre to convert the mobi to Epub, move that Epub file to Kindlegen, then run Kindlegen, generating new copy of Kindle book with added cover and otherwise identical to original.

Last edited by garygibsonsf; 12-16-2010 at 11:16 AM.
garygibsonsf is offline   Reply With Quote
Old 12-16-2010, 12:50 PM   #9
ATDrake
Wizzard
ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.
 
Posts: 11,517
Karma: 33048258
Join Date: Mar 2010
Location: Roundworld
Device: Kindle 2 International, Sony PRS-T1, BlackBerry PlayBook, Acer Iconia
Hey, glad you were able to find a solution that worked for you. Mobi format can be annoyingly tricky to work with.

Incidentally, a drag-and-drop way of generating Mobi from ePub is to use Amazon's Kindle Previewer app, which now incorporates KindleGen inside itself and auto-converts any ePubs you try to open with it. Might be easier for some than following even the relatively simple command-line instructions for KindleGen.
ATDrake is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing and maintaining title, author AndrewKantor Calibre 19 08-25-2014 04:34 AM
Maintaining scene breaks wellington Calibre 6 07-18-2010 08:43 PM
Does de-DRMing delete text to speech restrictions? Sydney's Mom Amazon Kindle 4 03-06-2010 11:46 PM
Maintaining original font sizes garygibsonsf Calibre 3 05-07-2009 04:38 AM
Remove books not deleting layout files davef Calibre 1 03-05-2009 12:11 PM


All times are GMT -4. The time now is 08:51 AM.


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