07-06-2009, 05:15 AM | #1 |
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Mobi -> Mobi "conversion"
Hello,
I have a mobipocket file that has every paragraph with hard-coded left alignment, and I'd like to change it and remove the explicit alignment. I don't want to change anything else in the file (metadata, etc.). What would be the best way to achieve this? After trying unsuccessfully with MobiPerl I managed to install Calibre, and tried with mobi2oeb, edit the .html, and oeb2mobi, but something is not fine here: 1. The original .mobi file is 2.6MB, the converted one is 1.6MB 2. The converted file adds vertical space above every paragraph. Indeed, when I convert again this new file to oeb, the .html file has "margin-top: 1em" for every paragraph, which was not present initially. 3. The original language (according to mobi-meta) is ENGLISH, the language of the converted file is NEUTRAL So, suggestions or advice for altering only the text in the mobipocket file and in a controlled way? EDIT: I've tried with version 0.5.11, by the way. Last edited by Jellby; 07-06-2009 at 06:06 AM. |
07-06-2009, 06:19 AM | #2 |
Resident Curmudgeon
Posts: 74,037
Karma: 129333114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Try mobi2oeb and then edit the HTML and try rebuilding it backinto a Mobipocket format eBook.
|
Advert | |
|
07-06-2009, 06:39 AM | #3 |
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
|
07-06-2009, 07:05 AM | #4 |
Resident Curmudgeon
Posts: 74,037
Karma: 129333114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Is this file one you can attach here?
|
07-06-2009, 07:12 AM | #5 |
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
No, sorry
|
Advert | |
|
07-06-2009, 07:40 AM | #6 |
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
... but I can post this one, which shows similar problems.
a.mobi is just my Mobipocket version of "The Picture of Dorian Gray". It was created with MobiPerl's html2mobi, from a mobi-flavoured HTML (no mobipocket creator involved). a-dir is what resulted from Code:
mobi2oeb a.mobi -o a-dir Code:
oeb2mobi a-dir/The\ Picture\ of\ Dorian\ Gray.opf -o b.mobi Code:
mobi2oeb b.mobi -o b-dir I also expected a-dir and b-dir to have very similar contents, but not even the images are the same (they have different sizes). And the HTML in a-dir has simple <p>...</p> tags, while the one in b-dir has <p style="margin-top: 1em; text-indent: 0pt; text-align: justify">...</p> |
07-06-2009, 10:23 AM | #7 |
creator of calibre
Posts: 43,866
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Don't use oeb2mobi, use any2mobi on the OPF file. Also make sure you have justification turned off.
|
07-06-2009, 11:09 AM | #8 | |
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
Code:
any2mobi --no-justification -o b.mobi a-dir/The\ Picture\ of\ Dorian\ Gray.opf And the result is a bit better, but still: 1. b.mobi is quite larger than a.mobi 2. The images in both a-dir/images and b-dir/images are not the same size 3. The HTML in b-dir still has <p style="margin-top: 1em; text-indent: 0pt"> instead of simply <p>, which is cumbersome and "wrong" (I don't want explicit top margin or indent). 4. The language of b.mobi is NEUTRAL instead of ENGLISH Wouldn't it be possible to have a couple of commands to just unpack and pack a mobi file with no data loss? (I admit I have no real knowledge of the internal structure of mobipocket format.) |
|
07-06-2009, 11:44 AM | #9 | |
Grand Sorcerer
Posts: 7,452
Karma: 7185064
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Kindle Voyage, Nexus 5, Kindle PW
|
Quote:
Calibre uses a totally different approach since it converts to a middle format and then have backends for the different output formats. |
|
07-06-2009, 11:51 AM | #10 |
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
|
07-06-2009, 11:57 AM | #11 |
Grand Sorcerer
Posts: 7,452
Karma: 7185064
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Kindle Voyage, Nexus 5, Kindle PW
|
|
07-06-2009, 12:21 PM | #12 |
creator of calibre
Posts: 43,866
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Having specialised tools for every format quickly leads to insanity. Instead calibre takes the approach that you write your HTML once and it will do its best to render it as faithfully as possible in all the formats.
There is probably some CSS lurking around somewhere in your decompiled MOBI that's causing the margins. Try setting --override-css "p {margin-top: 0pt}" |
07-06-2009, 12:47 PM | #13 | |
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
See, with ePUB is easy. I can unzip the .epub file, change "black" to "white" and zip everything again, and I don't care whether or not the XHTML validates or CSS classes are undefined. Well, I was thinking that it would be good to be able to do the same with mobipocket files, if you see what I mean. Of course, it's your program and you do what you see fit I just thought that since there are already programs that can parse and create mobipocket files, it shouldn't be too hard to have a program that blindly unpacks and packs mobipocket files. But anyway, I'm still confused that mobi->oeb->mobi->oeb generates such a "mess". Maybe the mobi->oeb conversion is more or less lossless, but then oeb->mobi tries to fix the HTML? I thougt that mobi->oeb would already fix things so that the subsequent oeb->mobi->oeb would be rather transparent. Last edited by Jellby; 07-07-2009 at 04:44 AM. |
|
07-06-2009, 01:20 PM | #14 |
creator of calibre
Posts: 43,866
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
I don't actually recall what mobi2oeb and oeb2mobi do (it's ages since I've used an 0.5 version of calibre) but at least mobi2oeb converts mobipocket markup to proper HTML and I believe (though I'm not sure) oeb2mobi converts HTMl to mobipocket markup
|
07-08-2009, 08:41 AM | #15 | |
Wizard
Posts: 3,413
Karma: 13369310
Join Date: May 2008
Location: Launceston, Tasmania
Device: Sony PRS T3, Kobo Glo, Kindle Touch, iPad, Samsung SB 2 tablet
|
Quote:
Congratulations! Regards, Alex |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Transfer Web pages to Kindle - what do you use? "Print to MOBI" an option? | guiyoforward | Amazon Kindle | 8 | 09-06-2010 12:50 AM |
EPUB to MOBI: "Failed: Convert book 1 of 1" | Jillo | Introduce Yourself | 4 | 02-20-2010 06:49 PM |
Content Mobi Reference ("Huge Collections") on Kindle | Mike L | Amazon Kindle | 26 | 04-28-2009 03:14 PM |
"Secure" PDF and "Secure" Mobi docs? | AceHarddrive | iRex | 9 | 05-08-2008 09:13 PM |
New ".mobi" domain names are coming in May 2006 | Bob Russell | Lounge | 3 | 04-25-2006 05:38 PM |