I have a byte array of an image in RGBA (received from a request in django) and I want this in grayscale. How can I do it?
Basically, I have a bytestring (e.g., b'\x00\x00\x00....\x00'
, single string of bytes of RGBA values of an image) and I want to convert it into a grayscale numpy array like:
[[0, 0,...,0],
[255,0,...,0],
[...],
[...]]
The length of the byte array is 360000
for an image of 300x300
pixels.