# Create a Colored Image from a Gray Image [Solved]

I am new here and I need some help.

I have a gray image, and I need to colour it using Python.

This is the kind of images I have:

And I need to transform it to be like the images that can be plot by using matplotlib ColorMap "CMRmap" like this one and save it:

Thank you in advance for helping me.

Expanding on @Miki's comment, you simply need to use a colormap. The colored image shows the CMRmap colormap.

import cv2
import matplotlib.pyplot as plt

plt.imshow(img, cmap='CMRmap')
plt.plot()


Output:

Matplotlib lists all the colormaps here

Sounds like you've figured out the colormap part, but not the saving. Building on Shawn's answer, if you want to save the figure, make a call to plt.savefig() instead of plt.show(). Then pass the path you want to save it to as an argument.
import cv2