I am trying to specify the colors of my image in Integer format instead of (R, G, B) format. I suggested that I need to create the image in "I" mode, as according to the documentation:
Image mode determines the type and depth of the pixel in the image. The current version supports the following standard modes:
- 1 (1-bit pixels, black and white, stored with one pixel per byte)
- L (8-bit pixels, black and white)
- P (8-bit pixels displayed in any other mode using the color palette)
- RGB (3 x 8-bit pixels, true color)
- RGBA (4x8-bit pixels, true color with transparency mask)
- CMYK (4x8-bit pixels, color separation)
- YCbCr (3x8-bit pixels, color video format)
- i (32-bit signed integer pixels)
- F (32-bit floating point pixels)
However, this is similar to a grayscale image. Is this expected? Is there a way to specify a color image based on a 32-bit integer? In my MWE, I even allowed PIL to decide how to convert βredβ to βIβ format.
MWE
from PIL import Image ImgRGB=Image.new('RGB', (200,200),"red")
source share