Code Monkey home page Code Monkey logo

mangle's Introduction

Mangle

Mangle is a cross-platform image converter and optimizer built for reading Manga on the Amazon Kindle and other E-ink devices written in Python. With this application you can easily:

  • Sort and organize images from different directories; bulk rename feature exists for output to the Kindle.
  • Optionally re-save images in a format Kindle will be sure to understand with no visible quality loss.
  • Downsample and rotate images for optimal viewing on Kindle, convert to grayscale to save space and improve contrast.
  • Automatically generate book meta-data so that your Manga is always properly detected and viewable in-order.

Motivation

Many years ago I received an Amazon Kindle as a gift. I immediately began playing around with it and reading about certain undocumented features that the Kindle has to offer. After a couple of hours I discovered it to be the perfect device for reading Manga is almost always grayscale, and the aspect ratio fits the Kindle's 600x800 pixel screen almost perfectly. Better yet, the Kindle's undocumented image viewer actually keeps track of the last image you viewed and thus you are always able to return to the page you left off on when you power on your Kindle. The device supports several popular image formats (jpeg, png, gif, etc), and is able to dither and downscale images to fit the screen.

However... The Kindle's image viewer does have certain shortcomings:

  • The Kindle is very picky about file format; any additional embedded data (thumbnails, comments, possibly even EXIF data) can confuse it. As a result, images may not display properly or even not at all (which actually prevents you from reading the given book, as one bad panel will prevent you from viewing subsequent images).
  • The first image that you view in a Manga (until the Kindle first writes the "bookmark" file) seems to be arbitrary even when files are named sequentially. About half the time it will correctly pick the first file in the batch, at other times it will pick out some other image seemingly at random.
  • Normally for Kindle to find your Manga scans you have to press Alt + Z on the home screen. I haven't always had luck with it correctly identifying image directories. At other times, after finding an image directory the Kindle will appear to hang while trying to access it (forcing you to return to the home screen).
  • The Kindle image viewer has no functionality to rotate images. So if there is a horizontally large image (such as what often happens with dual-page scans), it can be difficult to make out the text because the image is simply scaled to fit (consequently leaving a lot of wasted space at the bottom of the screen).
  • Scanlation images are oftentimes much larger than the 600x800 screen; not only does this make them take more space on your memory card but it also slows down image loading (the Kindle has to read more data off of the slow SD card and scale the image). Scanlations often also include color scans of covers and inserts which take up more space than a grayscale equivalent (which is would be fine for the Kindle's limited display).
  • Kindle's image viewer provides no way to sort images (to determine in which order they are shown). This can be very problematic especially considering that scanlation groups have differing naming conventions, and as a result files from later chapters may appear before earlier ones when you are reading your Manga (spoilers ftl).

Mangle was born out of my annoyance with these issues. The program name is a portmanteau of "Manga" and "Kindle"; I thought it was pretty clever at the time.

Usage

  1. Add the desired images and image directories to the current book.
  2. Re-order the images as needed (files pre-sorted alphabetically).
  3. Configure the book title and image processing options.
  4. Create a root-level directory on your Kindle called pictures (case sensitive).
  5. Export your images, selecting the pictures directory you just created.
  6. Enjoy your Manga (if it doesn't show up, press Alt + Z while on the home menu).

Dependencies

Installation

Pre-built binaries are available for download from the project's releases page.

mangle's People

Contributors

axu2 avatar catmanjan avatar chibidev avatar clach04 avatar foosoft avatar jleaders avatar leonidas-from-xiv avatar naparuba avatar tcyrus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mangle's Issues

I've ported the code to Python 3 and PyQt5 !

Hi, I've updated the code for Python 3 and PyQt5 locally.
I've now successfully run the updated application with Python 3 from terminal on Mac and used it to generate a 50+ page comic with the "Images & CBZ & PDF" option for Kindle Paperwhite. I've played with the other options, like stretching and borders and they seem to work.
I've tested saving and re-opening a .mngl file, deleting added images works fine.
Would you like to update this repo with these changes, i.e. shall I create Pull request for this, or would you prefer I fork your repo and do it there?
Congrats for the work on this!

How to run locally from source?

How do I run this locally from source? Windows or Mac, either is fine. My background includes web development in Python3 Flask. venv, etc

Invert file order

Is there an easy way to swap the file order when a folder is loaded ?

Support for CBZ

Hi,

It would be cool, if Mangle was able to output CBZ files. I just put all the exported files in a ZIP file, renamed it to CBZ and that's it (therefore can be done easily with Python's zipfile module). The advantage is that managing CBZ files is far easier than a bunch of normal files.

Heck, I think I should sit down and write some patches myself :)

Convert to dynamically generated UI

Hi,

PyQt can load UI files directly, it would be cool if you could switch to it. Then you wouldn't need to have pre-compiled not-to-be-modified source code (and a makefile, which is totally unnecessary then) in the repository and it would make development easier.

Suggestion: Command Line Interface

Don't quite know how to implement it or if theres plans on implementing it, but it would be nice to be able to use the command line to run this program directly from the command line. Something like this:

$./mangle.py --device kindle3 --rotate auto --exportdir F:/pics/Nagato/ /Nagato_No_Yuki_San/

Incorrect sorting for windows style numbering

I have a bunch of images named this way :

  • File (1).jpg
  • File (2).jpg
  • ...
  • File (10).jpg
  • File (11).jpg

While windows can sort them in the "correct" way.
Mangle sort them up unix style :

  • File (1).jpg
  • File (10).jpg
  • File (11).jpg
  • File (2).jpg
  • ...

Wishlist: Japanese page order

It's very cool that mangle has the "split page" option. Unfortunately it doesn't work for Japanese-language manga. The reason is that, if the scan is double-page, Western order will result like this:

0.jpg: [1|2]
1.jpg: [3|4]
2.jpg: [5|6]

(where the brackets represent images and the numbers, pages.) Japanese order, meanwhile, is like this:

0.jpg: [2|1]
1.jpg: [4|3]
2.jpg: [6|5]

I.e. the right half of each image comes first.

Would it be possible to add a binary option to use Japanese page order?

Thanks for great software!

What is the best way to convert the result to mobi/azw3?

I have the Kindle Paperwhite 4 model. When I process the images through Mangle and convert them to mobi through Calibre, even if I select not to process the images again, the result seen on the Kindle is images centered on the screen, none of the edges of the image touch the edges of the Kindle screen. Is there any way to get a result similar to KCC, with the images taking up as much of the screen as possible but without distortion?

Just an update for the new kindle.

I would submit a pull request, but I don't think that's even warranted for one line of code. also, I'm not sure of the palette on the new Kindle, though I am guessing it is more similar to that on the Kindle 4. Also, I'm no python programmer, and this is all I can really offer. Hopefully in the future I can do more.
For now, though, adding this to the Profiles section of mangle/images.py:

'Kindle Paperwhite': ((758, 1024), Palette15b),

Thank you, and keep up the good work.

Make the program a package

Hi,

It would be cool if you could make everything except mangle.pyw a package, so I can just install the package into site-packages and the launcher script into the bin directory, for an Arch Linux package.

Issues with setup.py

Currently it only supports Windows, and does not have any of the dependencies listed. You may want to think about using setuptools.

Also, the scripts have

#!/usr/bin/env python

when they should specify that they use python2.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.