applying an image's colormap to another image

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

What I would like to do is this:
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, display the intensity color-mapped to the same
colours the original RGB had.

Any tips, or even better code or pseudocode would be greatly appreciated.

Thanks
Matteo

You might have better luck asking the scikit-image people, or the Pillow people. ImageMagick might also have what you are looking for.

Cheers!

Ben Root

···

On Wed, Jan 27, 2016 at 11:23 PM, Matteo Niccoli <matteo@…4556…> wrote:

Can something like this (which by the way I can’t get to work):

http://stackoverflow.com/questions/3114925/pil-convert-rgb-image-to-a-specific-8-bit-palette

What I would like to do is this:

  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

  1. convert it to intensity, display the intensity color-mapped to the same

colours the original RGB had.

Any tips, or even better code or pseudocode would be greatly appreciated.

Thanks

Matteo


Site24x7 APM Insight: Get Deep Visibility into Application Performance

APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month

Monitor end-to-end web transactions and take corrective actions now

Troubleshoot faster and improve end-user experience. Signup Now!

http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

According to the PNG header, this image does not have a palette (i.e. a
list of colors). The data chunks define the image as an array of NxMx3
values (N rows, M cols, 3 channels=no alpha), each value being defined
using 8 bits. I may however badly understand what you call the "own
colormap"...

You still can convert it to a grayscale img representing the intensity
(NxM values), but you then lose some information and you cannot display
it back with the same colors as originally. Because some different RGB
tuple are converted into the same intensity level, you can then not
discriminate them using the intensity image only.

Maybe there is some trick to convert to a grayscale image where those
RGB values are converted to almost-equal-but-different intensity levels
that would enable the later reconstruction, but I am not aware of...

Fabrice

···

Le mercredi 27 janvier 2016, Matteo Niccoli a écrit :

Can something like this (which by the way I can't get to work):
python - PIL: Convert RGB image to a specific 8-bit palette? - Stack Overflow
-specific-8-bit-palette

What I would like to do is this:
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, display the intensity color-mapped to the
same colours the original RGB had.