When I tried to find is there a specific color point in the image, I find there is not clear comment in the pillow document.
I hope I could find the HSV value range in Pillow.
I am not sure the value range of HSV in Pillow. I read the pillow document, but it only says the HSV model is 3*8 pixels, Hue, Saturation, Value color space. Unfortunately, there are different HSV models with different value range I found on google. That confused me.
Could you give more explanation in the document?
Any thoughts on https://pillow.readthedocs.io/en/latest/reference/ImageColor.html?highlight=hsv#color-names?
Any thoughts on https://pillow.readthedocs.io/en/latest/reference/ImageColor.html?highlight=hsv#color-names?
Thanks for your help.
That page implies the value range of the HSV mode in Pillow is not CSS3-style, but the real value range is still unclear.
I did some tests.


The color should be red if it is CSS3-style, but the true value for red is


I guess the value range for HSV model is H: 0-255, S: 0-255, V:0-255, Maybe?
HSV isn't a mode for Image.new(mode, size, color):

Use something like this, where HSV is the usual 0-360, 0-100%, 0-100%:
from PIL import Image, ImageColor
Image.new(mode="RGB", size=(100, 100), color=ImageColor.getrgb("hsv(0, 100%, 100%)")).show()

HSV isn't a
modeforImage.new(mode, size, color):
- https://pillow.readthedocs.io/en/latest/reference/Image.html#PIL.Image.new
- https://pillow.readthedocs.io/en/latest/handbook/concepts.html#concept-modes
Use something like this, where HSV is the usual 0-360, 0-100%, 0-100%:
from PIL import Image, ImageColor Image.new(mode="RGB", size=(100, 100), color=ImageColor.getrgb("hsv(0, 100%, 100%)")).show()
Thanks a lot. It is really helpful.
I wrote some extra code to show the problem.


When I used the getpixel in the HSV mode, the return values are between 0-255, which is not consistent with the common value ranges and this may lead to problems when users define color ranges. I think this difference should be pointed out in the document or update the getpixel for the HSV mode.
There's no such thing as HSV mode for Pillow images. See https://pillow.readthedocs.io/en/stable/handbook/concepts.html
You cannot convert to HSV mode. This is documented: https://pillow.readthedocs.io/en/stable/reference/Image.html
You have an RGB mode image (print(im.mode)) and the getpixel values are RGB.
There's no such thing as HSV mode for Pillow images. See https://pillow.readthedocs.io/en/stable/handbook/concepts.html
You cannot convert to HSV mode. This is documented: https://pillow.readthedocs.io/en/stable/reference/Image.html
You have an RGB mode image (
print(im.mode)) and the getpixel values are RGB.
Sorry, my bad. I did not read the comment of convert carefully.
The page says HSV is supported by the current release

In practice, I found that if I convert the image to HSV mode it can work and the color value of the pixel is different from the value in RGB mode.


If I convert the same image to HSL mode, the code cannot run.

If Pillow images cannot convert to HSV, why the convert can work for HSV but cannot work for HSL? It is strange.
Sorry, it does indeed say HSV there! Will check again!
Any thoughts on pillow.readthedocs.io/en/latest/reference/ImageColor.html?highlight=hsv#color-names?
Thanks for your help.
That page implies the value range of the HSV mode in Pillow is not CSS3-style, but the real value range is still unclear.
I did some tests.
The color should be red if it is CSS3-style, but the true value for red is
I guess the value range for HSV model is H: 0-255, S: 0-255, V:0-255, Maybe?
Yes, that's right, all three are 0-255 here. Sorry for the confusion!
Fundamentally, anything in Pillow that鈥檚 not explicitly bigger or smaller is an 8bit per channel image.
Is there any reason to range between 0-255 on values that should be degrees and percentage ? Range from 0-1 or the actual range is fundamentally less confusing.. even if the doc try to fill that gap.
I suspect it would just have been for similarity with the other modes. Even if we did agree that HSV should be 0-1, Pillow values backwards compatibility highly, so I don't think a change like adjusting the value range for a mode would make it in, given that it otherwise works.
They're 0-255 because they're 8 bit ints, the same as all of the other multichannel images in Pillow.