https://github.com/pklaus/python-colorscale
A toolkit to convert false color images to their original gray scale image.
https://github.com/pklaus/python-colorscale
Last synced: about 1 month ago
JSON representation
A toolkit to convert false color images to their original gray scale image.
- Host: GitHub
- URL: https://github.com/pklaus/python-colorscale
- Owner: pklaus
- Created: 2013-02-28T14:51:47.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2018-05-15T18:51:28.000Z (about 7 years ago)
- Last Synced: 2025-03-26T13:03:19.196Z (about 2 months ago)
- Language: Python
- Homepage: https://pypi.org/project/colorscale/
- Size: 13.7 KB
- Stars: 6
- Watchers: 2
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### Python package colorscale
This package was written to facilitate working with 'false color'. Many scientific fields work with image files to visualize two-dimensional scalar data. The raw data can then be represented as a grayscale image. For different reasons, representing these data in false color can be useful. **This package helps to convert grayscale images to 'false color'.** On the other hand, quite often it is desirable to have access to the original values of a false color plot. If the color scale (or 'color map') is known and it is bijective (a reversible one to one mapping), the original gray scale image can be recovered from the false color image using this tool, too.
### Installation
pip install colorscale
### Usage
After installing, two command line tools will be available:
* `to_color_scale` and
* `to_gray_scale`.Start them with the `--help` flag to learn how to use them:
$ to_color_scale --help
usage: to_color_scale [-h] -s {tillscale} [-b {pil,cv2}] IMAGEFILE
Convert an image saved as false color to grayscale
positional arguments:
IMAGEFILE The image to convert
optional arguments:
-h, --help show this help message and exit
-s {tillscale}, --colorscale {tillscale}
Desired color scale
-b {pil,cv2}, --backend {pil,cv2}and
$ to_gray_scale --help
usage: to_gray_scale [-h] -s COLORSCALE IMAGEFILE
Convert an image saved as false color to grayscale
positional arguments:
IMAGEFILE The image to convert
optional arguments:
-h, --help show this help message and exit
-s COLORSCALE, --colorscale COLORSCALE {tillscale}
Desired color scale### ToDo
It is desirable (and on the ToDo list) to make this package work with the colormaps built into matplotlib.
Here's a list of the relevant matplotlib documentation pages:* [List of matplotlib colormaps](https://matplotlib.org/examples/color/colormaps_reference.html)
* [Builtin colormaps module `matplotlib.cm`](https://matplotlib.org/api/cm_api.html)
* [base class `matplotlib.colors.Colormap`](https://matplotlib.org/api/_as_gen/matplotlib.colors.Colormap.html#matplotlib.colors.Colormap)
* [Colormaps tutorial (in-depth discussion about colormaps, including colorblind-friendliness)](https://matplotlib.org/tutorials/colors/colormaps.html)### Resources
* Package in Python Package Index (PyPI):
* Package on Github:### Author
* Philipp Klaus