What is the difference between images in 'P' and 'L' mode in PIL?

前端 未结 3 1795
太阳男子
太阳男子 2020-11-22 15:35

According to https://pillow.readthedocs.io/en/3.1.x/handbook/concepts.html#concept-modes,

  1. What are the difference between them?
  2. Can we convert from on
3条回答
  •  无人及你
    2020-11-22 15:54

    The "L" mode represents grayscale here.... So it can hold any of 256 shades of Gray (includes black and white as Gray shades).

    The "P" mode can hold 256 different colors like red,blue, green etc....

    Convertion from one another, if you mean converting images from grayscale to color or vice versa.... Yes it is possible....

    Examples: 8 bit black and white image ( technically Gray scale image)are "L" and any 8 bit color images are "P" mode..

提交回复
热议问题