[SOLVED] How to convert RGB matrix to Grayscale array in Python?


This Content is from Stack Overflow. Question asked by Luigi Salerno

I need an help to convert an array of rgb values (3 channels) into a single dimension grayscale array.
Thank you so much.


If you are using PIL or Pillow to hold your RGB values as an image, the conversion is trivial:

gray_image = rgb_image.convert('L')

This Question was asked in StackOverflow by Luigi Salerno and Answered by Mark Ransom It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?