Mobileread
KFX format detail for Comic/Manga
#1  innocenat 05-12-2022, 02:11 PM
Are there any information out there on KFX/KPF format other than what is on MobileRead wiki?

I tried to read KFX Output plugin source code but it get confusing really quickly when I get to the ION thingy.

What I wanted to do is to automate conversion of AZW3 manga to KFX manga. I figured with fixed layout book the KPF/KFX file is not going to be too complicated to be created by outside tools. Right now I have automate pretty much everything except having to open Kindle Create to import images and set table of content manually.

Also I am trying to figure out if it is possible to modify KPF/KFX to tag some pages as double-page spread. There doesn't seem to be this option in Kindle Create, and I don't have access to KFX file with this feature enabled.

If anyone could point me in the right direction I would be grateful.
Reply 

#2  jhowell 05-12-2022, 08:02 PM
Quote innocenat
Are there any information out there on KFX/KPF format other than what is on MobileRead wiki?
There is no good documentation that I am aware of.

There as bits and pieces of information scattered throughout various threads here on MobileRead, including this one: KFX Format

Amazon has documented Ion which is the underlying data storage format for KFX. See https://amzn.github.io/ion-docs/

Quote innocenat
I tried to read KFX Output plugin source code but it get confusing really quickly when I get to the ION thingy.
I wrote that for my own use and was asked to make it into a calibre plugin. It lack comments and isn't a great learning tool.

Quote innocenat
What I wanted to do is to automate conversion of AZW3 manga to KFX manga. I figured with fixed layout book the KPF/KFX file is not going to be too complicated to be created by outside tools. Right now I have automate pretty much everything except having to open Kindle Create to import images and set table of content manually.

Also I am trying to figure out if it is possible to modify KPF/KFX to tag some pages as double-page spread. There doesn't seem to be this option in Kindle Create, and I don't have access to KFX file with this feature enabled.
The online documentation for Kindle Create has some information on this. Prepare Comic eBooks with Kindle Create (See the section on Facing Pages and Single Pages.)

Basically if you set two pages as being "facing pages" they will be shown together when viewed in landscape mode. If you need them to always be shown together you have to combine the images into a single page before importing into Kindle Create.

Trying to modify the KPF to reflect that after the fact would be difficult to do correctly.
Reply 

#3  innocenat 05-13-2022, 12:28 AM
Quote jhowell
There is no good documentation that I am aware of.

There as bits and pieces of information scattered throughout various threads here on MobileRead, including this one: KFX Format

Amazon has documented Ion which is the underlying data storage format for KFX. See https://amzn.github.io/ion-docs/
Thank you!

Quote jhowell
The online documentation for Kindle Create has some information on this. Prepare Comic eBooks with Kindle Create (See the section on Facing Pages and Single Pages.)

Basically if you set two pages as being "facing pages" they will be shown together when viewed in landscape mode. If you need them to always be shown together you have to combine the images into a single page before importing into Kindle Create.

Trying to modify the KPF to reflect that after the fact would be difficult to do correctly.
That's actually not it.

In manga, there are "double-spread" as in the it's a single, big image splitted in left and right page. In properly formatted KFX book (directly from Amazon), when view in portrait mode, the first page is shown with small preview of double-spread. Going to next page will go the second page of the spread, but tapping the double-spread preview will display both page in landscape mode. It's a very nice feature, but as far as I know there's no corresponding setting in Kindle Create (actually Kindle Create doesn't even support setting language to Japanese yet).
Reply 

#4  jhowell 05-13-2022, 05:48 PM
Quote innocenat
That's actually not it.

In manga, there are "double-spread" as in the it's a single, big image splitted in left and right page. In properly formatted KFX book (directly from Amazon), when view in portrait mode, the first page is shown with small preview of double-spread. Going to next page will go the second page of the spread, but tapping the double-spread preview will display both page in landscape mode. It's a very nice feature, but as far as I know there's no corresponding setting in Kindle Create (actually Kindle Create doesn't even support setting language to Japanese yet).
"Facing pages" is what Kindle Create calls double page spreads.

Turning on the "Preview Double Page Spread" option in the Aa menu enables extra handling by the Kindle. If two pages are set as facing and the content on right side of the left page closely matches the left side of the right page then a thumbnail appears at the bottom to show them both together. This is logic internal to the Kindle. There is no extra metadata involved other than the pages being set as facing.
Reply 

#5  innocenat 05-14-2022, 12:18 AM
Quote jhowell
"Facing pages" is what Kindle Create calls double page spreads.

Turning on the "Preview Double Page Spread" option in the Aa menu enables extra handling by the Kindle. If two pages are set as facing and the content on right side of the left page closely matches the left side of the right page then a thumbnail appears at the bottom to show them both together. This is logic internal to the Kindle. There is no extra metadata involved other than the pages being set as facing.
Oh. I swear I must have tried that a dozens time with no result, but I just tried again and it worked. Sorry.

And apparently it's not even if the page is closely match. It seems if there's enough non-white pixel on either of the page edge, it will be shown as double spread.
Reply 

#6  innocenat 06-09-2022, 04:36 PM
Just want to note my progress in case someone stumbled upon this thread from google.

Using kfxlib from jhowell (can be found in KFX Output Plugin code), the YJ_Book class can be created easily with kpf input file. After decode_book() the ION can be accessed via book.fragments. To get the sense of what fragment is what the code in yj_*.py help a lot.

In the end I gave up. I first tried to just add new TOC item to the KPF book, but there seems to be multiple places where this need to be added. Futhermore, after a few hour playing with the structure, I still cannot figure which ION hold the "spine" of the book.
Reply 

Today's Posts | Search this Thread | Login | Register