Search code examples
pythonpython-imaging-librarycolor-space

PIL Image.fromArray's color space


I have an image I created from an array of RGB values. Something like [(104, 104, 104), (56, 72, 81), ...]

In order to do this, I used the Image.fromArray method in PIL. However, I have no idea what color space PIL uses for this - the ICC profile is nonexistent and the "mode" of the image is "L".

Can someone please tell me what the color space of the PIL images are? Thanks!


Solution

  • You didn’t create an RGB image. You created a grayscale image. To create a color image, you meet an array with the correct shape. Something like this:

    [[(r,g,b), (r,g,b), ...],
     [(r,g,b), (r,g,b), ...],
     ...]
    

    The L means grayscale.

    If you create an RGB image it won’t have an explicit color space. If you want it to have a color space you have to specify it.