KindleGen

From MobileRead
Jump to: navigation, search

KindleGen is a proprietary tool provided by Amazon to be used to convert source files to AZW format and KF8 be used on the Amazon Kindle reader. Amazon has a self-publishing page that covers submitting a file for publication.

Contents

[edit] Overview

KindleGen is a command line tool used to build eBooks that can be sold through Amazon's Kindle platform. Amazon intends this tool as the main way to submit files to be published on their web site. However, since AZW is almost identical in format to MOBI files, tools used to create MOBI files can also be used to generate AZW files by simply renaming the extension. There are some subtle differences however.

This tool is best for publishers and individuals who are familiar with HTML and want to convert their HTML, XHTML, XML (OPF/IDPF format), or ePub source into a Kindle Book. It can also generate the APNX page number file with the right input.

KindleGen is also the tool to use for background conversion and batch conversion of ePub files and is used by most word processing tools that advertise support for MOBI or Kindle format. These tools will make the conversion transparent for the user.

While KindleGen is a command line tool, the engine itself is also included in Kindle Previewer. You can drag a source file to Kindle Previewer, and it will use KindleGen to convert it and then display the results.

Since version 2 of KindleGen, there are are actually 3 files inside a KindleGen created file. There is a KF8 file, a MOBI file, and the original source file. This means the KindleGen file is 3 times as big as it was in version 1. It is possible to strip out the source file using KindleUnpack. When a user orders an eBook, Amazon will use its knowledge of the user’s hardware to deliver the right formatted file for that user by splitting the KindleGen file.

[edit] From the changelog

[edit] 1.2 changes

This 1.2 update includes:

  • Support for page numbers in a book through NCX pageLists or page-map xml
  • Support for AAC file format as audio/video source
  • Support for Latin language (ISO-639-1 code: la)
  • Bug fixes from older version of KindleGen

[edit] 2.4 changes

From this version on, KindleGen began offering support for the newer KF8 format. The program generates two eBooks, one for KF8 and one for old Mobi (sometimes called KF7 or K7), in the same file. When a user purchases a book from Amazon they will divide the file and ship the correct version for the device they own. See KindleUnpack for a tool that can take these apart for your personal use.

It now seems to expect an ePub source input of the ePub OPF.

  • Added support for a localized interface in Chinese and Japanese languages.
  • Added support for "display:none" CSS Property in Mobi.
  • Removed soft-hyphens for older devices and allowed them to be visible only on KF8 devices.

[edit] 2.5 changes

This 2.5 update includes:

  • Improved transparent PNG conversion: Transparent PNG images are now converted to JPEG and will use a white background.
  • Unintended line breaks in Mobi7 when using some CSS properties ("margin-top: 0px" and "margin-bottom: 0px") has been fixed.
  • Resolved indentation issues in KF7 related to bullets and numbered lists.
  • Allows creation of KF7 book with Indexes (e.g. dictionaries).
  • CSS property "display: none" no longer induces an additional space in Mobi7 for inline tags.

[edit] 2.7 changes

This 2.7 update includes:

  • Data URI support for images and embedded fonts so that they can be referred directly in HTML and CSS files (For more details about data uri, please refer http://dataurl.net).
  • Enabled support for JP vertical rendering and multiple writing modes. Values can be specified in OPF files using meta tags (ex: <meta name="primary-writing-mode" content="vertical-rl" />). The valid values are horizontal-lr, vertical-lr, horizontal-rl, vertical-rl.
  • Enabled support for facing pages and double page spreads. Values can be specified in OPF through “properties” attribute in itemref tag. The valid values are facing-page-left, facing-page-right, page-spread-left, page-spread-right.
  • Added Mobi7 support for HTML tags with multiple classes (e.g., class="class1 class2 class3")
  • KindleGen errors out when original resolution metadata is not specified in the format "integer x integer" for fixed format books.
  • Validates ordinals used in the region magnification JSON are unique for fixed format books.
  • Added KF8 and KF7 file size stats that will be displayed after conversion.

[edit] 2.8 changes

This 2.8 update includes:

  • Support for converting XMDF file format has been added. Refer Kindle Publishing Guidelines for more info.
  • Support for epub3 toc nav element has been added. This is equivalent to the navMap element in the NCX (also known as NCX toc). Epub3 toc nav element is preferred over NCX navMap element, if both are given. But if the Nav HTML is not specified according to the specification, we will try to fall back to NCX if one exists. If we cannot fallback to NCX, then we would error out. Refer here for more info about EPUB3 toc nav specification.
  • Support for epub3 landmarks nav element has been added. This is equivalent to the OPF guide element. Epub3 landmarks nav element is preferred over OPF guide element, if both are given. Refer here for more info about EPUB3 landmarks nav specification.
  • Support for specifying the following metadata in epub3 format
    • Specifying cover image using properties attribute in manifest
    • Specifying book level layout with “rendition:layout” property
    • Specifying book level orientation with “rendition:orientation” property
    • Specifying “dc:identifier” value in URN format.
    • Refining authors in “dc:creator” metadata using marc relators scheme
    • Providing multiple titles with one among them refined as main title using title-type property.
    • Refer here for more info.
  • Support for referring images in NCX toc if and only if the same image is directly referred in the spine.
  • Support for Galician language (gl, gl-es).

[edit] 2.9 Changes

  • Support for page layout properties (double page spread, facing pages and blank page) when specified as image in spine.

Check the latest release notes and known issues at https://kindlegen.s3.amazonaws.com/manual.html

[edit] Managing KF8 and KF7 differences

It may be that there is a need to make two different versions of an eBook to support the newer KF8 format and the older Mobi sometimes called KF7 (or K7). The best way to handle these differences is with a special construction in the CSS file which will be used by KindleGen to make the needed changes in the file. For example

<style type="text/css">
@media amzn-kf8 {
   .mobi7only {
       display: none;
   }
   .kf8only {
       display: block;
   }
}
@media amzn-mobi {
   .mobi7only {
       display: block;
   }
   .kf8only {
       display: none;
   }
}
</style>
<div class="mobi7only">...MOBI version...</div>
 <div class="kf8only">...KF8 version...</div>

TOC differences must be handled in favor of KF7. KF8 books can be built using the ePub NCX to generate a TOC the KF7 version requires a TOC.html file be present in the document or no TOC will be present in the eBook. Of course a TOC.html file will also work fine in a KF8 eBook.

[edit] SRCS Record

KindleGen adds the entire contents of the source files used to create the AZW file as a record inside the file itself. This typically doubles the size of the file. There is a tool called Kindlestrip that can be used to remove this information. For more information see: MobileRead discussion thread on how to get this tool and how to use it. Click for the technical details of the SRCS Record. You can also use the option -dont_append_source to avoid adding the source file.

[edit] Available Platforms

Unlike most Mobi creation tools KindleGen is available for a wide variety of platforms:

  • KindleGen for Windows (2003, XP, Vista, 7)
  • KindleGen for Linux 2.6 i386
  • KindleGen for Mac OS 10.5 and above i386
  • Kindle Plugin for Adobe InDesign® v0.95 (Beta)

[edit] Options

The following command line options are shown in the binary

-preserve_img: Original Image size will be preserved
-image64K: The maximum size of the image is restricted to 64K
-image128K: The maximum size of the image is restricted to 128K
-gif: gif image conversion (no jpeg)
-c0: No compression
-c1: Standard PalmDOC compression
-c2: Kindle Huffdic compression
-allscript: Authorize all scripting
-western: Forced Windows-1252 output
-verbose: Verbose output
-noparseback: Parse back won't be built
-regserver: The XOPFPlugin type library has been registered
-unregserver: The XOPFPlugin type library has been unregistered
-donotaddsource: Source files will not be added. Replaced -dont_append_source.
(hidden) Skip the HTML cleanup
-genhdcontainers: eMM will be built with given resolutions
-locale <locale option> : To display messages in selected language
(hidden) creates json position map file for debugging purpose.
-gen_ff_mobi7: (hidden) creates mobi for older devices.
(hidden) Using manual(tag based) fragmentation mode for building Webkit reader compatible mobi.
(hidden) Webkit reader Compatible mobi will be built
(hidden) fragsize
(hidden) custom image size will be used for resizing
(hidden) Amazon creator tool or pipeline

[edit] Misc

KindleGen is also built-in to the Kindle Previewer application and that serves as a GUI over KindleGen. Note that Kindle Previewer is currently the only way to generate AZK files for iOS use.

[edit] For more information

Personal tools
Namespaces

Variants
Actions
Navigation
MobileRead Networks
Toolbox