Mangle
Hardware: Jailbroken Kindle
Status: In progress
Source: github.com/daniebker/Mangle
Mangle lets you read manga panel by panel on a Kindle.
Caveat: Mangle only works on a jailbroken Kindle with KUAL installed. It won’t run on a stock Kindle.
Why I built it
I wanted to read manga on my Kindle, but a whole page shrunk down to fit the screen is often too small to read. The text in the speech bubbles and panels was hard to make out, and zooming in by hand on e-ink is slow and fiddly.
So I wanted the Kindle to zoom to one panel at a time. Detecting panels is too much work for the Kindle to do while you read, so Mangle does it ahead of time. A preprocessor on your computer takes PDFs and CBZs, finds the panels, then compresses and converts every page and panel for the Kindle’s e-ink screen. The Kindle only has to show small images that are already the right size, so page turns stay fast.
How it works
Mangle has two parts:
- Preprocessor (Python, runs on your computer). It reads a PDF, CBZ or ZIP of pages and:
- finds the panels with Kumiko, falling back to a simpler OpenCV detector, and sorts them into reading order (right to left for manga, or left to right for western comics);
- shows pages it isn’t confident about whole, rather than guessing;
- crops each panel from the full-resolution original, so zoomed panels stay sharp;
- converts every image to grayscale, resizes it to fit the screen, tunes the contrast for e-ink and dithers it down to 16 gray levels as a small 4-bit PNG;
- packs everything into a ZIP with a manifest.
- Reader (C, runs on the Kindle, started from KUAL). It opens those ZIPs and shows them panel by panel or page by page.
Reading on the Kindle
- Panel mode moves one panel at a time. Each page is shown whole first, so you see the layout before zooming in.
- Page mode moves a whole page at a time. Double-tap the centre of the screen to switch.
- Tap the sides to go forward or back, or use the page-turn buttons.
- The library shows your books as covers on a shelf, with your progress under each one.
- Your place in every book is saved, and the Kindle goes to sleep on the book’s cover when you stop reading.
Changelog
v0.4.0
Added
- Sleep: after 2 minutes idle the book’s cover (page 1, or page 2 if the first is blank) is drawn and the Kindle is suspended to RAM; the power button wakes it and reading resumes.
-t SECchanges the delay. - Menu bar
Settingsentry with a Sleep on/off switch, saved in the state folder.
v0.3.0
Added
- Menu bar: tap the top edge of the screen while reading to open it; its
Libraryentry returns to the library.
v0.2.0
Added
- Preprocessor accepts
.pdfinput: each page is rendered with pypdfium2 (--pdf-dpi, default 200) and goes through the usual panel detection and e-ink optimisation. - Library shelf view: books are shown as a grid of covers (first page) standing on shelves, with title and reading progress under each cover.
- Built-in 8x13 bitmap font for drawing text into the framebuffer.
Changed
- Library taps: tap a cover to open it, bottom strip changes shelf page, top strip exits.
- Panel mode shows each paneled page whole before its panels.
v0.1.0
- Initial release: preprocessor, Kindle reader, KUAL extension.