Skip to content Skip to sidebar Skip to footer

How To Change Color Of Image Using Python?

I have a small gray image. I need to create many colored copies of this image (yellow one, green one, ...). I don't need replace single color. My original image contains many shade

Solution 1:

This might be overkill, but you could easily use functionalities from the OpenCV library (python bindings) to tint your gray scale images in color.

Try looking at these folks C++ code: http://answers.opencv.org/question/50781/false-coloring-of-grayscale-image/. Analogs the the functions that they use likely exist in the python library.

Here's a recommended course of action:

  1. Convert the image to BGR (opencv convention lists red green blue in reverse order) from grayscale using cv2.cvtColor()
  2. Apply an artificial color map of your choice (cv2.applyColorMap()) see: http://docs.opencv.org/modules/contrib/doc/facerec/colormaps.html

Post a Comment for "How To Change Color Of Image Using Python?"