Perhaps something like this:
ColorConvert[
PixelValue[im, pos],
OptionValue[Options[im], ColorSpace] -> ImageColorSpace[im]
]
where im
is an image and pos
is a pixel position, e.g., {100, 150}
.
The basic idea is to use ColorConvert
to automatically get the correct head for the image's colour space (e.g. RGBColor
or CMYKColor
). For this, we need the syntax ColorConvert[list, colspace1 -> colspace2]
where colspace1
should define the interpretation of the values in the list.
At this point, it is not entirely clear to me how to correctly handle images that have embedded ColorProfileData
. I asked a new question for this here: