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.

Files for colormapize, version 0.2
Filename, size File type Python version Upload date Hashes
Filename, size colormapize-0.2-py2.py3-none-any.whl (4.6 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size colormapize-0.2.tar.gz (3.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page