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 02-16-2016, 09:57 AM   #331
baf
Evangelist
baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.
 
Posts: 405
Karma: 2330752
Join Date: May 2012
Device: kt
Quote:
Originally Posted by KevinH View Post
I simply can not get Previewer to actually make a kfx (or kfd) file of any kind no matter which device I pick. Any hints on how to invoke it to see it actually it make a kfx file from an azw3?

KevinH
I use the sample epub from amazon, link is in FAQ – Q8 on that page. I just drag this epub over Previewer and it produces kdf and some other files in a hidden directory and mobi file somewhere in Documents.
Mobi file doesn't have any enhancements.
The file I posted is deleted during conversion process, so you must be quick to capture it

I will have a look at env vars later.
baf is offline   Reply With Quote
Old 02-16-2016, 10:31 AM   #332
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,732
Karma: 24031401
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by KevinH View Post
I simply can not get Previewer to actually make a kfx (or kfd) file of any kind no matter which device I pick. Any hints on how to invoke it to see it actually it make a kfx file from an azw3?
The .kdf file is generated by the Windows version of Kindle Previewer in the user's TEMP folder. If you enter %temp% in the Run dialog box, you'll find it in a book subfolder of a random UUID folder.
Doitsu is offline   Reply With Quote
Old 02-16-2016, 11:06 AM   #333
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 7,087
Karma: 91577715
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
Here is an overview of what I have been able to discover so far from examining kdf files:


Html and css files are replaced by text with associated formatting instructions in binary data structures. Semantic tags, such as em and strong, produce no difference in the result other than the formatting they represent.

The possible formatting instructions are based loosely on css properties, but changed and somewhat simplified.

The end result is much more like a reflowable pdf than an html document.

Also, there are no soft hyphens or other hyphenation indicators added to the text.

Last edited by jhowell; 02-16-2016 at 11:11 AM.
jhowell is online now   Reply With Quote
Old 02-16-2016, 11:23 AM   #334
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 7,087
Karma: 91577715
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
Quote:
Originally Posted by HarryT View Post
We did know that one of the goals of the KFX format was to supply device-specific formatting - eg image resolutions tailored to the device.
It is still unclear to me how many variations are in use. So far I have only seen two: low resolution B/W jpeg-xr for e-ink kindles and high resolution color jpeg for everything else.

One thing I have noticed is that the 'attachables' files, containing book images, are limited to about 3MB each. Books with lots of images will have several of these files. When downloading one of these books with the newer kindle apps, the download progress bar will quickly turn green. At that point the app will allow the book to be opened, even though image files are still being downloaded. This seems like a useful feature for those with slow internet connections.
jhowell is online now   Reply With Quote
Old 02-16-2016, 11:23 AM   #335
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,796
Karma: 146391129
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by baf View Post
I also played with some temporary files created during conversion. That gives an idea about optimization process.
For example have a look at changes introduced to the original xhtml file, while converting epub to enhanced mobi.
Your URL leads to a 404. Please repost.
JSWolf is offline   Reply With Quote
Old 02-16-2016, 11:41 AM   #336
baf
Evangelist
baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.
 
Posts: 405
Karma: 2330752
Join Date: May 2012
Device: kt
Quote:
Originally Posted by JSWolf View Post
Your URL leads to a 404. Please repost.
Updated my post
baf is offline   Reply With Quote
Old 02-16-2016, 11:42 AM   #337
darryl
Wizard
darryl ought to be getting tired of karma fortunes by now.darryl ought to be getting tired of karma fortunes by now.darryl ought to be getting tired of karma fortunes by now.darryl ought to be getting tired of karma fortunes by now.darryl ought to be getting tired of karma fortunes by now.darryl ought to be getting tired of karma fortunes by now.darryl ought to be getting tired of karma fortunes by now.darryl ought to be getting tired of karma fortunes by now.darryl ought to be getting tired of karma fortunes by now.darryl ought to be getting tired of karma fortunes by now.darryl ought to be getting tired of karma fortunes by now.
 
darryl's Avatar
 
Posts: 3,108
Karma: 60231510
Join Date: Nov 2011
Location: Australia
Device: Kobo Aura H2O, Kindle Oasis, Huwei Ascend Mate 7
Quote:
Originally Posted by jhowell View Post
Here is an overview of what I have been able to discover so far from examining kdf files:


Html and css files are replaced by text with associated formatting instructions in binary data structures. Semantic tags, such as em and strong, produce no difference in the result other than the formatting they represent.

The possible formatting instructions are based loosely on css properties, but changed and somewhat simplified.

The end result is much more like a reflowable pdf than an html document.

Also, there are no soft hyphens or other hyphenation indicators added to the text.
Thanks for the overview. It is nice to see that some progress is being made. This makes me wonder whether there is a completely new rendering engine at work or perhaps simply a modified one to incorporate dealing with the new formatting instructions.
darryl is offline   Reply With Quote
Old 02-16-2016, 12:08 PM   #338
baf
Evangelist
baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.
 
Posts: 405
Karma: 2330752
Join Date: May 2012
Device: kt
Quote:
Originally Posted by KevinH View Post
baf, can you get a dump of the environment variables that are set during the conversion to kfx? The internal Epub conversion jar seems to look for AMZN_ prefixed environment variables in places but so it might help to see what is getting set.

KevinH
I don't see any such variables.
Previewer runs following command to convert epub to kdf. Run it from lib/fc directory. Then watch /tmp directory for resulting files. Also notice the files that are created and then deleted.
This applies to OS X, should be similar for windows.
Code:
jre/bin/java -cp lib/EpubToKFXConverter-1.0.jar:lib/* com.amazon.kfxconverter.app.KFXGenApp -libDir . -tmpDir /tmp -outDir /tmp -inputFile sample.epub -locale en -amzncreator "Kindle Previewer 3.0.0"
The command takes following parameters. I don't see any profiling options here though:

Code:
Usage: <main class> [options]
  Options:
    -amzncreator
       tool version (optional)
    -compressionType
       Compression type
  * -inputFile
       Input file
  * -libDir
       Base directory where all the required libraries are present
  * -locale
       The language for Kindlegen logs
  * -outDir
       Output directory where mastermobi is stored
    -outFileName
       Output file name for .mobi, if not given the input filename is taken
  * -tmpDir
       Temp directory where kdf is stored
baf is offline   Reply With Quote
Old 02-16-2016, 12:39 PM   #339
DaleDe
Grand Sorcerer
DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.
 
DaleDe's Avatar
 
Posts: 11,470
Karma: 13095790
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2 & Air 2, iPhone 7
Quote:
Originally Posted by jhowell View Post
The previewer produces a new file type, KDF, which is basically KFX data in an sqlite3 database instead of a KFX container. I wonder if that is something specific to the previewer software or if this is an intermediate format produced as part of their production tool chain. I'm learning quite a bit from examining these files.
Please record your knowledge in our wiki.

Dale
DaleDe is offline   Reply With Quote
Old 02-16-2016, 02:40 PM   #340
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,807
Karma: 6000000
Join Date: Nov 2009
Device: many
Hi jhowel,

Quote:
Originally Posted by jhowell View Post
The end result is much more like a reflowable pdf than an html document.
Yes, that explains the fixed height and width properties throughout. My guess (complete wag) is they map a reflowable epub into a size fixed to a specific device (or family of devices), handling automatic hyphenation (since the boundaries are now known), and then use webkit to effectively "print" it to a pdf-like format, and deliver that to your device. Kerning, ligatures, font metrics (known fonts!), hyphenation positions, Dropcaps, etc can all be worked out in advance in a fixed layout and converted into a form suitable for viewing. Then sell the whole pile as "Enhanced formatting" which is similar to what can be achieved in a finished format like pdf.

KevinH
KevinH is online now   Reply With Quote
Old 02-16-2016, 02:45 PM   #341
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,807
Karma: 6000000
Join Date: Nov 2009
Device: many
Hi jhowell,

Does the generated have any drmion atached to it or is it DRM free? If DRM free, what chances do you think someone might have to convert this reflowable pdf-like beast back to pure html and css?

Thanks,

KevinH
KevinH is online now   Reply With Quote
Old 02-16-2016, 03:18 PM   #342
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 7,087
Karma: 91577715
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
Quote:
Originally Posted by KevinH View Post
My guess (complete wag) is they map a reflowable epub into a size fixed to a specific device (or family of devices), handling automatic hyphenation (since the boundaries are now known), and then use webkit to effectively "print" it to a pdf-like format, and deliver that to your device. Kerning, ligatures, font metrics (known fonts!), hyphenation positions, Dropcaps, etc can all be worked out in advance in a fixed layout and converted into a form suitable for viewing. Then sell the whole pile as "Enhanced formatting" which is similar to what can be achieved in a finished format like pdf
I don't think it's quite that bad. They are still using a reflowable document model, it's just not html.

A lot of what got added in that intermediate html file shown by baf doesn't appear in the kdf output. It looks to me that they are determining the final styling result of css for each html element and then translating that to their own simplified binary document model.

I don't see any sign that they are pre-rendering to specific devices. That would be difficult given all of the possible font-face/size combinations and screen sizes for all iOS/Android devices. Also, I have been able to move non-device locked kfx files between devices of different resolutions and they rendered just fine.

Drop caps appear to be handled by using their own non-standard style properties created just for that purpose.

The document text doesn't appear to be altered at all. I think that kfx hyphenation is handled by the renderer on the user's device using a dictionary.
jhowell is online now   Reply With Quote
Old 02-16-2016, 03:37 PM   #343
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 7,087
Karma: 91577715
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
Quote:
Originally Posted by KevinH View Post
Does the generated have any drmion atached to it or is it DRM free? If DRM free, what chances do you think someone might have to convert this reflowable pdf-like beast back to pure html and css?
There is no sign of DRM or encryption in the kdf files produced by the previewer.

In kfx format some information, such as metadata, is in an unencrypted container and the format of that data matches the format of the metadata found in a kdf file.

In kfx all of the actual text and document layout is in an encrypted container. In kdf that data is all in the clear and is encoded in the same binary format as the metadata. (The encrypted kfx container almost certainly holds the same data format, once decrypted.)

The data format is a representation of a nested data structure, sort of a binary version of json. I previously worked out some of the details and it is discussed earlier in this thread and there is even some code that partially handles it already in calibre. (See the PackedIon class.)

I think it is quite doable to turn kfx/kdf back into html, but it would take some work to figure out how their document model maps back to standard html. It should be possible to do this preserving visible content and formatting, but some details, such as the exact css classes used in the original document will be lost. Of course the drm used for kfx books would still be an issue.

Last edited by jhowell; 02-16-2016 at 09:15 PM.
jhowell is online now   Reply With Quote
Old 02-17-2016, 09:17 AM   #344
Notjohn
mostly an observer
Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.
 
Posts: 1,519
Karma: 987654
Join Date: Dec 2012
Device: Kindle
>I think that kfx hyphenation is handled by the renderer on the user's device using a dictionary.

I have a new Paperwhite and a new Fire; the latter shows auto hyphenation but the former doesn't.

Also I don't understand how there could be a fixed page width in a reflowable book when the user has the ability to change the font size.

I'm glad to see this discussion continued!
Notjohn is offline   Reply With Quote
Old 02-17-2016, 09:28 AM   #345
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 7,087
Karma: 91577715
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
Quote:
Originally Posted by Notjohn View Post
I have a new Paperwhite and a new Fire; the latter shows auto hyphenation but the former doesn't.
If you see this difference for the same book then the most likely cause is that book not being in KFX format on your Paperwhite. You can verify by connecting to a computer via USB and finding the book in the documents directory.

If the book is in fact downloaded in KFX format on both devices and it renders differently I would like to know more about that.

Quote:
Originally Posted by Notjohn View Post
Also I don't understand how there could be a fixed page width in a reflowable book when the user has the ability to change the font size.
That was speculation by KevinH based on the contents of the intermediate file format posted by baf. I agree with you that the contents are reflowable, not fixed.
jhowell is online now   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Kindle format vs ePub format is like using a compiler vs winzip? Julius Caesar Workshop 1 09-01-2013 07:34 PM
iPhone Convert epub format to kindle for iPhone format. Is it possible? thecyberphotog Apple Devices 16 03-14-2013 01:04 AM
No 'epub' format shown in Plugboards Format dropdown list kakkalla Library Management 3 06-16-2012 04:23 AM
Ebook in PRC format will not convert to any other format Katelyn Calibre 0 10-01-2010 07:02 PM
Master Format for multi-format eBook Generation? cerement Workshop 43 04-01-2009 12:00 PM


All times are GMT -4. The time now is 12:59 PM.


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