Skip to main content

Generate a colormap from an image

Project description

https://img.shields.io/badge/Made%20at-%23AstroHackWeek-8063d5.svg?style=flat

About

This is a small package to easily generate colormaps from images which was built as a fun hack and should not be used to generate colormaps for serious visualization work since there is no guarantee that the colormaps made will be e.g. perceptually uniform.

Installing

To install:

pip install colormapize

Using

To use, run:

colormapize your_image.jpg colormap_name

where colormap_name is what you want to call your colormap, for example:

colormapize your_image.jpg kittens

This should open a Matplotlib window. Click once to define the start of a path and click again to define the end of the path. You can then use the + and - keys to add more samples along the path. If you are not happy with the path, just click twice again to define a new path. Once you are happy with it, press ‘enter’ or ‘c’ and you will see a preview of the colormap on the right of the image, and the colormap will also be saved to e.g.``cmap_kittens.py``. You can continue to redefine the path until you are happy with it, and the file will be overwritten every time you press ‘enter’ or ‘c’. Close the window once you are done.

To use, make sure the colormap file (e.g. cmap_kittens.py) is in the same directory as the directory where you want to make plots, and you can then use it as follows in other scripts:

import colormap_kittens

...

plt.imshow(mydata, cmap='kittens')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

colormapize-0.2.tar.gz (3.8 kB view hashes)

Uploaded Source

Built Distribution

colormapize-0.2-py2.py3-none-any.whl (4.6 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page