Color Values, Conversion Of
in
Programming Questions
•
2 years ago
I've got a short sketch which I'm using to load an image in and then output the RGB values of each pixel. (I'm going to use MaxLink to connect this to Max/MSP ultimately, but for now I'm just working in Processing and using [println] to test the output).
Code:
The output to the console from [println] is like this:
PImage inputImage;
void setup (){inputImage = loadImage ("input.jpg");size (200, 200);}
void draw (){image (inputImage, 0, 0);loadPixels();for (int x = 0; x < inputImage.width; x++){for (int y = 0; y < inputImage.height; y++){color outputColour = inputImage.get (x, y);println (outputColour);fill (outputColour);rect (50, 50, 50, 50);}}}
Right now, as the loop iterates through the pixels at x, y it updates the colour 'outputColour', which for testing purposes I'm printing to the console.
-9473166
-9734542
-9734285
-9602956
-9537163
-9340297
-9077895
etc...
What type of data is this? Basically what I want to get is the RGB values of each pixel. Is there a mode switch I can use? These negative ints are messing with my vibe, man.
Thanks
Zeb
1
