Skip to content

Correct images inside ePub files with CMYK color space and without color profiles.

Notifications You must be signed in to change notification settings

f1amy/epub-image-corrector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ePub Image Corrector

A Python script that is correcting wrong colors of images inside ePub files with CMYK color space and without color profiles.

About

Someday when I was starting reading an ePub eBook it got wrong colors for like 75% of pages.

The investigation concludes that the publisher messed up when compiling content into an eBook with images color space and color profiles.

The problem is that most ePub readers (that are probably browsers) can't properly display an CMYK image without color profile (but Microsoft Edge can).

Fixing ePubs manually would be very long, also when you don't know which of them corrupted. That's where this scripts comes in.

Installation

In order to launch the script you will need a Python interpreter installed on your system, instructions can be found there.

In addition to interpreter you must also install dependencies using this command:

pip3 install -r requirements.txt

The script tested on Python 3.6 and should work on both Linux and Windows.

Requirement

For legal reasons, a color profile isn't included out of the box. Thus, in order to work, you must download it yourself. I tested some of these:

  • JapanColor2001Coated.icc
  • Photoshop5DefaultCMYK.icc
  • USWebCoatedSWOP.icc
  • UncoatedFOGRA29.icc

The best experience I had was with USWebCoatedSWOP.icc profile.

It doesn't mean that you'll have the same experience with your files, so it is worth to try other profiles.

You could download some profiles from Adobe (link for Windows) or color.org (link).

Usage

$ ./epub-image-corrector.py --help
usage: epub-image-corrector.py [-h] [-r] [-f] profile path

Correct images inside ePub files with CMYK color space and without color
profiles.

positional arguments:
  profile          Path to .icc CMYK profile.
  path             Path to .epub file or directory that contains ePub files.

optional arguments:
  -h, --help       show this help message and exit
  -r, --recursive  Recursive into subdirectories.
  -f, --force      Force replace color profile for CMYK color space images.

Examples

For single file

./epub-image-corrector.py /profiles/some-profile.icc /books/comics/some-comic.epub

For single file with force replace profile

./epub-image-corrector.py /profiles/some-profile.icc /books/study/some-book.epub -f

For a directory

./epub-image-corrector.py /profiles/some-profile.icc /books/journals

For a directory recursive

./epub-image-corrector.py /profiles/some-profile.icc /books -r

About

Correct images inside ePub files with CMYK color space and without color profiles.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages