optimized version of mangareader-to-ebook (Python 3 compatible)