Can something like this (which by the way I can't get to work) be done using scikit-image?
http://stackoverflow.com/questions/3114925/pil-convert-rgb-image-to-a-specific-8-bit-palette


I've done similar things in Matlab before:
https://mycarta.wordpress.com/2012/04/05/visualization-tips-for-geoscientists-matlab-part-ii/
but I'd really like to be able to do it in Python.


What I would like to do currently is:
1) Import an RGB image, which would have its own colormap - say this one
for example:
https://upload.wikimedia.org/wikipedia/commons/b/b3/Jupiter_new_hubble_view_above_pole.png

2) convert it to intensity, say like this:

intnst = 0.2989 * rgb[:,0] + 0.5870 * rgb[:,1] + 0.1140 * rgb[:,2] # get the intensity
intensity = np.rint(intnst) # rounds up to nearest integer

 
3) display the intensity color-mapped to the same colours the original RGB had.

Any tips, ideally withrcode or pseudocode would be greatly appreciated.

Thanks,
Matteo