Gone Awry Goes Kindle



Create an experimental electronic artist book for Kindle. Using the Manga/Comic/Graphic Novel example provided as part of Kindle Format 8 Publishing Tools to create the electronic version of Gone Awry.

Use KindleGen and Kindle Previewer to create the electronic edition and check quality. The linux version of calibre is used to check the generated .mobi file, and to tag and edit metadata. Then, upload the generated .mobi file to the Kindle Direct Publishing web-app, and fill in all rest of the metadata in a browser.

From the web app, publishing it on Amazon is easy.


Amazon’s current proprietary format is: Kindle Format 8, or KF8. The file extension is .mobi. The Amazon specifications are in: Amazon Kindle Publishing Guidelines.

Parts of this also use OPF, the packaging for epub.

Target Display Hardware

Some key data points about display resolution of select current-model e-readers. Plan is to only support color, high-resolution devices.

  • Kindle Fire HD 7″ resolution is 1280 x 800 x 216 ppi8.9″ resolution is 1920 x 1200 x 254 ppi
  • Nexus Tablets 7″ resolution is 1920 x 1200 x 323 ppi (WUXGA, 1.6), 10″ resolution is 2560 x 1600 x 300 ppi (WQXGA, 1.6)
  • iPad 7″ resolution is 1024 x 768 x 163 ppi (XGA, 1.3), 9.7″ resolution is 2048 x 1536 x 264 ppi (QXGA, 1.3)

Versus layout for Gone Awry.

  • Print (19 x 13, 1.46)
  • ebook 1 (19.2 x 12, 1.6)
  • kindle publishing guidelines for fixed layout (1024 x 600 or 1536 x 900 zoom, 1.7)

Image Sizing and Aspect Ratio

First, resize existing .svg base documents in inkscape to the correct aspect ratio. For this project, the aspect ratio is 1.6. Thus, inkscape page sizes are changed from 19 x 13 inches to 19.2 x 12 inches.

This file is then exported as a transparent bitmap, at 2560 x 1600 @ 300dpi.

Next step is to process it in CS6 Photoshop on Mac OS X. The following transforms:

  • Layer->Flatten
  • Image->Image Size to 2560 x 1600
  • File->Save As jpeg, 9, 10, 11 qualities, but adjust to hit below 800k

HTML doc

Re-write example to suit Gone Awry, based on prototyping with a DocBook 5.0 XML form to generate the beginning HTML. Take this, edit the .opf and .ncx files to create a manifest and a table of contents/touch list, and bundle it up with the toplevel “images” directory such that the resulting filenames in the generated “gone-awry.opf” file are correct.

Kindle (KF8) doc

Unpack kindle binaries on linux, and run on the master list of files (the .opf file) as:

kindlegen gone-awry-v2.html -c0 -verbose gone-awry.opf

That should chug along, spewing a bunch of information. Pay attention, and fix any issues. The last bit of information before a successful creation of the .mobi file is related to the file size, and download time. Something like:

Info(prcgen):I1041: The file format version is V8
Info(prcgen):I1032: PRC built successfully
Info(prcgen):I15000:  Approximate Standard Mobi Deliverable file size :   0019466KB
Info(prcgen):I15001:  Approximate KF8 Deliverable file size :   0019526KB

From this, one can make back-of-the-envelope calculations about the royalty rates. For 70% royalties, the publisher must pay Amazon $0.15 per 1MB of .mobi file delivered. Thus, for a 40MB file, the delivery charge would be $6. So, the price would have to be more than this to break even. For 30% royalties, there is no delivery fee so pricing could feasibly drop below $6.


The final book looks like “Gone Awry Kindle Edition” on Amazon’s marketplace.

Future work would be to shift to SVG containers, improving text legibility by un-rasterizing the text or presenting a vector text layer, and look at ways to add “scroll anchors” such that a “page flick” motion would speed through the next couple of pages before alighting on the specified anchor.


Some notes from 2011 on self-publishing.

Current best sellers in the Kindle Store. August graphic novel sales, information, reviews.

Some of the meta-problems with pagination, and mapping electronic books to print books. Some meta-hating on some aspects of the current state-of-the-art.

A Digital Shift: Libraries, Ebooks and Beyond. Corey Doctorow, Library of Congress, 2013

libabigail aka C++ Instrumentation and Analysis


Libabigail is shorthand for the alternative, which just so happens to be a bit of a mouthful: “GNU Application Binary Interface Generic Analysis and Instrumentation Library.”

This is a current compiler/language research topic to provide a serialized XML form of C++11 sources as compiled by GNU g++, and a way of looking at the data produced. This data can be parsed to more accurately determine ABI compatibility, to better understand code additions and changes and how these change the exported interface, to examine and prototype how C++11 language usage determines linkage, etc.

Discussions about this functionality started at the “C++ ABI BOF” at the GNU Tools Cauldron 2012 Prague. This work was created at Red Hat, by Benjamin Kosnik, Jason Merrill, and Dodji Seketeli. Some updates at 2013 Cauldron. See “Cauldron 2013 GCC ABI BOF.”

Development sources are written in mixed C++2003/C++11, hosted in git, based on GCC trunk, and tracking what will to be gcc-4.9.0. The branch is administered by Dodji Seketeli.

Please feel free to try it out, but know that the state is experimental and quite raw.

Feedback and assistance is welcome.

Starting from a git working tree as described in GitMirror, add the libabigail repository as follows:

git checkout -b libabigail origin/libabigail

To stay up to date, use:

git pull


How is this expected to be used? First, a libabigail top-level directory is either added to the GCC sources or compiled as a first step and put into some PREFIX directory. The GNU C++ compiler, g++, is configured to use this new library with:

configure .. --with-abigail=$PREFIX

Thus configured, the C++ front end is built, installed, and used as the primary compiler. All sources are compiled with an additional flag, -fdump-abi.

So, this command:

g++ -c -fdump-abi somefile.cc

Creates two files:

  • somefile.o

    The object file

  • somefile.cc.bi

    The XML instrumentation file



Toplevel namespace is abigail.

The interface header files in libabigail:


Doxgen is used to document the sources: try make html to generate, and look in libabigail-build-dir/doc/api/html/index.html to read it.

And then the binary interface is in libabigail.so.


Each object file is compiled to a translation_unit. The sum of all translation_units is a corpus.

Compiler-generated files are read as serialized input to a translation_unit and de-serialized. And any modified form is written to an output file in serialized form.

The interface to the C++ intermediate representation is best viewed in the class documentation.

Opinions and Wild Guesses

1. Some formatting tips.

– classes “read” as types, data, members functions. In that order.

– doxygen gives feedback on the state of the doxygen parse in the form of a log, as you run “make html.” Read this log: doxygen is a fuzzy parse. There are formatting things you can do to make it better. Do them. It’s easier to fix up these errors then figure out why the generated HTML is poor.

2. Use of shared_ptr is intriguing.

There are not really a lot of existing usage patterns for std::shared_ptr in libstdc++ (in C++11 , , ). If you look at the page of boost idioms for shared_ptr usage:


One notices that there’s not a lot of use of shared_ptrs in interfaces. Yet in libabigail, that is very common. I’m curious about this style question.

And most usage is up for debate, see this stack overthow discussion about using shared_ptrs as function arguments. Should the parameters be const reference or just shared_ptr? And another.

Some interesting thinking from microsoft on shared_ptr usage.

3. Use of virtual binary operators is odd.

The old adage is that operators cause havoc in overload resolution. These are binary operators, but the stigma lingers. A vague feeling is not the same as something definite that’s a hard no. It’s more like the pirate code than a strict coding convention or hard rule. I would say that if you ever start to see strange bugs due to overloading, consider making these (non-operator) functions.

Otherwise, do it.

SVG Notes

Scalable Vector Graphics aka (svg) is standardized by the W3C. Current standard is SVG 1.1 Second Edition.

SVG is often rendered into a raster format, for viewing on a monitor or as part of a web page. For web pages, it is rendered by a layout engine.

  • blink (new chrome)
  • gecko (mozilla/firefox)
  • webkit (safar, old chrome)

On the desktop, SVG files can be created and edited by applications like Inkscape and Adobe’s Illustrator. There is also an on-line SVG editor, called svg-real. Other renderers are Apache’s Batik and Adobe’s SVG Viewer.

SVG files are text files. As such, text editors like emacs can edit SVG files. (For Emacs, use control-C control-C to switch between editing and image modes.)

One caveat when using inkscape to create SVG-1.1 compliant files. All text must be explicitly converted to text, so that “flowed” text is the default. With this done, all text blocks will show up normally in web browsers like chrome and firefox.

Some basics about SVG for the web. The Mozilla SVG docs. O’Reilly SVG Essentials.

Notes on Generative, openFrameworks


Processing, openFrameworks are related. For Processing, see Casey Reas at UCLA.

See: Hello, Processing! For a beginning.

Some people: Casey Reas (west), Ben Fry (east). Via John Maeda. Chris Reilly (west), Chandler McWilliams


Base is ulloa config, Fedora 18 on x86_64. Secondary is Fedora 17 on x86_64. Note, you’ll need to have a video card and driver suitable for running OpenGL. Intel graphics are easy, Nvidia can be done but will need to use proprietary drivers, and not the default nouveau driver.

Follow notes from openframeworks site for linux/64 install, starting with going into the Fedora scripts directory:

cd /home/bkoz/src/openframeworks.v0073_linux64/scripts/linux/fedora

And then:

sudo ./install_codeblocks.sh

sudo ./install_codecs.sh

These should install some packages, if the codeblocks IDE and some of the development packages for audio or video codecs aren’t already installed. Then, do this script, which may start compiling things:

sudo ./install_dependencies.sh

Some editing/slight work-arounds for cairo includes, means using CXXFLAGS=”-I/usr/include/cairo” or doing the following small patch:

*** libs/openFrameworks/graphics/ofCairoRenderer.h.orig 2012-12-28 15:48:06.649358899 -0800
--- libs/openFrameworks/graphics/ofCairoRenderer.h      2012-12-28 15:48:59.502292659 -0800
*** 1,10 ****
#pragma once

! #include "cairo-features.h"
! #include "cairo-pdf.h"
! #include "cairo-svg.h"
! #include "cairo.h"
#include "ofMatrix4x4.h"
--- 1,10 ----
#pragma once

! #include "cairo/cairo-features.h"
! #include "cairo/cairo-pdf.h"
! #include "cairo/cairo-svg.h"
! #include "cairo/cairo.h"
#include "ofMatrix4x4.h"

After applying the patch, the dependency-making script above should complete without error. It will probably end with something that looks like:

to launch the application

cd bin

Instead, go up a level and run the


script, and then then



If everything has gone correctly, then the last script(testAllExamples.sh) will throw up window after window of delicious OF candy, fun to watch. To go on to the next example, close the topmost window.

If you get to this point, then the preliminary setup should be correct.

linux tcp examples failing, start tcp server? kill firewall? punch holes for openframeworks ports?

Examine Examples

Open up the example project files within the Codeblocks IDE.

Start hacking

Put all projects into the compiled openframeworks directory, in the “apps” subdirectory.


0. Form+Code website, links

1. Generative Design website, code page table of contents.

2. openprocessing website, community site.

3. openFrameworks website.

4. ofauckland, ofxCairo examples for linux

4. creativeapplications.net

5. Golan Levin is or was an openframeworks user

6. memo’s libs (MSA libs) on github. Download, then copy into your addons directory.

7. toxiclibs, another good lib

8. podcast on creative coding

9. cinder, which is another, alternative framework not based on processing.

10. generative.net, another good meta-site