I would like to extract colours from a pixel. Little help please?
in
Programming Questions
•
7 months ago
Hi there all. I am currently using the following lines of code, to extract greyscale values from pixels in an image:
color c = get(x, y);
float greyscalein = brightness(c);
i have moved my project (a plotter, of sorts) onto working colour. therefore i would like to extract colour values instead.
Ideally in CMYK, but i'm sure it could be converted if it is in a different format.
i presume i need to change the "brightness" bit to something else, except what i really want is not to see what hue the pixel is, but rather, on 3 passes, HOW MUCH C, how much M and how much Y is on the pixel
any suggestions?
many thanks
Ol
color c = get(x, y);
float greyscalein = brightness(c);
i have moved my project (a plotter, of sorts) onto working colour. therefore i would like to extract colour values instead.
Ideally in CMYK, but i'm sure it could be converted if it is in a different format.
i presume i need to change the "brightness" bit to something else, except what i really want is not to see what hue the pixel is, but rather, on 3 passes, HOW MUCH C, how much M and how much Y is on the pixel
any suggestions?
many thanks
Ol
1