Skip to main content

# Grayscale to RGB Python script

Maps grayscale images to RGB based on a custom jet-like colormap. Outputs an images of the same size as the input file. Output image type can be defined by user, outputs png by default.

## How to use

### Dependencies

argparse 1.4.0

matplotlib 3.8.x

### Windows example using cmd python .grayscale_to_rgb.py –input-picture-path .images_inputgrayscale_example.tif –output-picture-path images_outputgrayscale_example_colormapped.png

### Linux

Replace every ` with `/.

## Colormap

Normalized Quantile | Mapped color name | Mapped color HEX code
—— | —— | —— |
0 | black | #000000 |
0.03 | blue | #0000FF |
0.25 | cyan | #00FFFF |
0.50 | lime | #00FF00 |
0.75 | yellow | #FFFF00 |
0.97 | red | #FF0000 |
1 | white | #FFFFFF |

## Example Grayscale to RGB image

Based on the example command

![Grayscale original](https://gitlab.bfabric.org/jens/grayscale-to-rgb/-/blob/main/input_images/grayscale_example.tif)

![Grayscale colormapped](https://gitlab.bfabric.org/jens/grayscale-to-rgb/-/blob/main/output_images/grayscale_example_colormapped.png)

![Original colormapped](https://gitlab.bfabric.org/jens/grayscale-to-rgb/-/blob/main/output_images/rgb_original.jpg)

Metadata

Release files for grayscale-to-rgb 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for grayscale-to-rgb 1.1.0
File Interpreter ABI Platform
grayscale_to_rgb-1.1.0-py3-none-any.whl Python 3 none any Details

Release files / grayscale_to_rgb-1.1.0-py3-none-any.whl

Download URL grayscale_to_rgb-1.1.0-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ba93380eaee76c75d89d6cf9d01644447d33a5ff744e72b7c6408a29720946d6
BLAKE2b-256 checksum
How to use checksums
0ce40a95f1ef052d1ac5e563a1211d09f2c6d8c83f86dc085edcbe655c5dbfd7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.10.12

Release history Release notifications | RSS feed

This release

1.1.0 This release

1 release file

1.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page