How to read a raw image using PIL?

前端 未结 4 1964
执笔经年
执笔经年 2020-11-29 05:31

I have a raw image where each pixel corresponds to a 16 bits unsigned integer. I am trying to read using the PIL Image.fromstring() function as in the following code:

<
4条回答
  •  余生分开走
    2020-11-29 05:49

    The specific documentation is at http://effbot.org/imagingbook/concepts.htm:

    Mode

    The mode of an image defines the type and depth of a pixel in the image. The current release 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, mapped to any other mode using a colour palette)
    • RGB (3x8-bit pixels, true colour)
    • RGBA (4x8-bit pixels, true colour with transparency mask)
    • CMYK (4x8-bit pixels, colour separation)
    • YCbCr (3x8-bit pixels, colour video format)
    • I (32-bit signed integer pixels)
    • F (32-bit floating point pixels)

    PIL also provides limited support for a few special modes, including LA (L with alpha), RGBX (true colour with padding) and RGBa (true colour with premultiplied alpha).

提交回复
热议问题