I have some pictures that I want to extract numerical value in RGB tuples using:
from PIL import Image
raw_data = np.array(Image.open("./image.jpg"))
However, I just realized that these images do not have build in icc profiles. In other words, when I use
Image.open("./image.jpg").info.get('icc_profile','')
I get None.
According to https://github.com/python-pillow/Pillow/issues/3270 , some cameras does not store color space into icc profile, instead it is stored into EXif file. I tried to print its exif.get(0xA001) and it is indeed in sRGB space.
However, I just wonder that when I use np.array(Image.open("./image.jpg"))
to get the numerical value of this image, will PIL realize that this image is in sRGB space and do the conversion into RGB value automatically? (it seems that np.array(Image.open("./image.jpg"))
and np.array(Image.open("./image.jpg").convert("RGB"))
give me the same results) or I have to take the numerical values I get and do gamma correction formula to convert from sRGB to RGB values myself?
Thanks!