daltonize


Namedaltonize JSON
Version 0.2.0 PyPI version JSON
download
home_pagehttps://github.com/joergdietrich/daltonize
Summarysimulate and correct for color blindness in matplotlib figures and images
upload_time2023-01-03 20:10:11
maintainer
docs_urlNone
authorJörg Dietrich
requires_python>=3.6
license
keywords
VCS
bugtrack_url
requirements matplotlib numpy Pillow
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Daltonize

![https://github.com/joergdietrich/daltonize/actions](https://img.shields.io/github/actions/workflow/status/joergdietrich/daltonize/main.yml)  ![](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/joergdietrich/9deb619232c8098b5e15d259ef5ed534/raw/covbadge.json)

Daltonize simulates the three types of dichromatic color blindness for
images and matplotlib figures. Generalizing and omitting a lot of
details these types are:

* Deuteranopia: green weakness
* Protanopia: red weakness
* Tritanopia: blue weakness (extremely rare)

Daltonize can also adjust the color palette of an input image or matplotlib figure such
that a color blind person can perceive the full information
content. It can be used as a command line tool to convert pixel images
but also as a Python module. If used as the latter, it provides an API
to simulate and correct for color blindness in matplotlib figures.

This allows to create color blind friendly vector graphics suitable
for publication.

Color vision deficiencies are in fact very complex and can differ in intensity from person to person.
The algorithms used in here and in many other comparable software packages are based on often simplifying assumptions. [Nicolas Burrus](http://nicolas.burrus.name/) discusses these simplification and reviews daltonize and other software packages in this [blog post](https://daltonlens.org/opensource-cvd-simulation/).


## Installation

```
pip install daltonize
```

## Usage

As a command line tool:

```
$ daltonize.py -h
usage: daltonize.py [-h] [-s | -d] [-t {d,p,t}] [-g {2.4}] input_image output_image

positional arguments:
  input_image
  output_image

optional arguments:
  -h, --help            show this help message and exit
  -s, --simulate        create simulated image
  -d, --daltonize       adjust image color palette for color blindness
  -t {d,p,t}, --type {d,p,t}
                        type of color blindness (deuteranopia, protanopia,
                        tritanopia), default is deuteranopia (most common)
  -g --gamma {2.4}      exponent of the sRGB gamma correction. The default 
                        2.4 corresponds to an effective exponent of 2.2
```

As a Python module:

```
In [1]: from daltonize import daltonize

[ Create a figure ]

In [10]: sim_fig = daltonize.simulate_mpl(fig, copy=True)

In [11]: daltonized_fig = daltonize.daltonize_mpl(fig, copy=True)
```

## Credits

Based on the work and original matlab code by Onur Fidaner, Poliang
Lin, Nevran Ozguven. This can be found in 'doc/'.

Based on original Python code by Oliver Siemoneit.

Further information on color blindness and daltonization is available
at many web resources, including http://www.daltonize.org/

Color blind friendly color maps can be found at
http://colorbrewer2.org/ All of these are included in the python
matplotlib and seaborn plotting libraries.

## Example Images for Color Blindness

The directory 'example_images/' contains three example Ishihara plates
to test for red-green deficiency. This table describes what people
with normal, red/green deficient color vision, and total color
blindness see on these plates:

| Plate     | Normal      | r/g deficiency  | total color blindness |
|:---------:|:-----------:|:---------------:|:---------------------:|
| 3	    | 29          | 70              |       x	            |
| 7         | 74          | 21		    |       x               |
| 8	    |  6          |  x		    |       x               |

You can verify the r/g deficiency column by running daltonize.py with
the `-s/--simulate` option and `-t/--type d` or `p` on these images.

### Normal

![IshiharaPlate3](example_images/Ishihara_Plate_3.jpg)

### Deuteranopia

```
daltonize -s -t=d example_images/Ishihara_Plate_3.jpg example_images/Ishihara_Plate_3-Deuteranopia.jpg
```

![IshiharaPlate3](example_images/Ishihara_Plate_3-Deuteranopia.jpg)

### Protanopia

```
daltonize -s -t=p example_images/Ishihara_Plate_3.jpg example_images/Ishihara_Plate_3-Protanopia.jpg
```

![IshiharaPlate3](example_images/Ishihara_Plate_3-Protanopia.jpg)

## License

This code is released und the GNU GPL version 2. See COPYING for details.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/joergdietrich/daltonize",
    "name": "daltonize",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "",
    "author": "J\u00f6rg Dietrich",
    "author_email": "joerg@joergdietrich.com",
    "download_url": "https://files.pythonhosted.org/packages/7c/41/87e9f4efd429b1834f3692d07bee35c5886f837ef73de92a5bd461f11e37/daltonize-0.2.0.tar.gz",
    "platform": null,
    "description": "# Daltonize\n\n![https://github.com/joergdietrich/daltonize/actions](https://img.shields.io/github/actions/workflow/status/joergdietrich/daltonize/main.yml)  ![](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/joergdietrich/9deb619232c8098b5e15d259ef5ed534/raw/covbadge.json)\n\nDaltonize simulates the three types of dichromatic color blindness for\nimages and matplotlib figures. Generalizing and omitting a lot of\ndetails these types are:\n\n* Deuteranopia: green weakness\n* Protanopia: red weakness\n* Tritanopia: blue weakness (extremely rare)\n\nDaltonize can also adjust the color palette of an input image or matplotlib figure such\nthat a color blind person can perceive the full information\ncontent. It can be used as a command line tool to convert pixel images\nbut also as a Python module. If used as the latter, it provides an API\nto simulate and correct for color blindness in matplotlib figures.\n\nThis allows to create color blind friendly vector graphics suitable\nfor publication.\n\nColor vision deficiencies are in fact very complex and can differ in intensity from person to person.\nThe algorithms used in here and in many other comparable software packages are based on often simplifying assumptions. [Nicolas Burrus](http://nicolas.burrus.name/) discusses these simplification and reviews daltonize and other software packages in this [blog post](https://daltonlens.org/opensource-cvd-simulation/).\n\n\n## Installation\n\n```\npip install daltonize\n```\n\n## Usage\n\nAs a command line tool:\n\n```\n$ daltonize.py -h\nusage: daltonize.py [-h] [-s | -d] [-t {d,p,t}] [-g {2.4}] input_image output_image\n\npositional arguments:\n  input_image\n  output_image\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -s, --simulate        create simulated image\n  -d, --daltonize       adjust image color palette for color blindness\n  -t {d,p,t}, --type {d,p,t}\n                        type of color blindness (deuteranopia, protanopia,\n                        tritanopia), default is deuteranopia (most common)\n  -g --gamma {2.4}      exponent of the sRGB gamma correction. The default \n                        2.4 corresponds to an effective exponent of 2.2\n```\n\nAs a Python module:\n\n```\nIn [1]: from daltonize import daltonize\n\n[ Create a figure ]\n\nIn [10]: sim_fig = daltonize.simulate_mpl(fig, copy=True)\n\nIn [11]: daltonized_fig = daltonize.daltonize_mpl(fig, copy=True)\n```\n\n## Credits\n\nBased on the work and original matlab code by Onur Fidaner, Poliang\nLin, Nevran Ozguven. This can be found in 'doc/'.\n\nBased on original Python code by Oliver Siemoneit.\n\nFurther information on color blindness and daltonization is available\nat many web resources, including http://www.daltonize.org/\n\nColor blind friendly color maps can be found at\nhttp://colorbrewer2.org/ All of these are included in the python\nmatplotlib and seaborn plotting libraries.\n\n## Example Images for Color Blindness\n\nThe directory 'example_images/' contains three example Ishihara plates\nto test for red-green deficiency. This table describes what people\nwith normal, red/green deficient color vision, and total color\nblindness see on these plates:\n\n| Plate     | Normal      | r/g deficiency  | total color blindness |\n|:---------:|:-----------:|:---------------:|:---------------------:|\n| 3\t    | 29          | 70              |       x\t            |\n| 7         | 74          | 21\t\t    |       x               |\n| 8\t    |  6          |  x\t\t    |       x               |\n\nYou can verify the r/g deficiency column by running daltonize.py with\nthe `-s/--simulate` option and `-t/--type d` or `p` on these images.\n\n### Normal\n\n![IshiharaPlate3](example_images/Ishihara_Plate_3.jpg)\n\n### Deuteranopia\n\n```\ndaltonize -s -t=d example_images/Ishihara_Plate_3.jpg example_images/Ishihara_Plate_3-Deuteranopia.jpg\n```\n\n![IshiharaPlate3](example_images/Ishihara_Plate_3-Deuteranopia.jpg)\n\n### Protanopia\n\n```\ndaltonize -s -t=p example_images/Ishihara_Plate_3.jpg example_images/Ishihara_Plate_3-Protanopia.jpg\n```\n\n![IshiharaPlate3](example_images/Ishihara_Plate_3-Protanopia.jpg)\n\n## License\n\nThis code is released und the GNU GPL version 2. See COPYING for details.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "simulate and correct for color blindness in matplotlib figures and images",
    "version": "0.2.0",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4e65c7a1d609f148301351b1f2dc8657548bcf7cce1e3d4148e49f1db7ff17e8",
                "md5": "5f79e8fe33db12ccefb15ef0bf628ce4",
                "sha256": "7191363abbb7625e56a3748402fab05096804a034fa361478fdfb75a60c90db2"
            },
            "downloads": -1,
            "filename": "daltonize-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5f79e8fe33db12ccefb15ef0bf628ce4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 15122,
            "upload_time": "2023-01-03T20:10:09",
            "upload_time_iso_8601": "2023-01-03T20:10:09.778073Z",
            "url": "https://files.pythonhosted.org/packages/4e/65/c7a1d609f148301351b1f2dc8657548bcf7cce1e3d4148e49f1db7ff17e8/daltonize-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7c4187e9f4efd429b1834f3692d07bee35c5886f837ef73de92a5bd461f11e37",
                "md5": "970949b6989f1e41f0b9ccbcaaee1d2c",
                "sha256": "194191c2febc5cdf955584e93a0d266e9fd92a477b57f08b76abe684ceb09d8a"
            },
            "downloads": -1,
            "filename": "daltonize-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "970949b6989f1e41f0b9ccbcaaee1d2c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 14757,
            "upload_time": "2023-01-03T20:10:11",
            "upload_time_iso_8601": "2023-01-03T20:10:11.144539Z",
            "url": "https://files.pythonhosted.org/packages/7c/41/87e9f4efd429b1834f3692d07bee35c5886f837ef73de92a5bd461f11e37/daltonize-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-03 20:10:11",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "joergdietrich",
    "github_project": "daltonize",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "matplotlib",
            "specs": [
                [
                    ">=",
                    "3.0.0"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    ">=",
                    "1.9.0"
                ]
            ]
        },
        {
            "name": "Pillow",
            "specs": []
        }
    ],
    "tox": true,
    "lcname": "daltonize"
}
        
Elapsed time: 0.04026s