Beginner > Color reading line by line ...
in
Programming Questions
•
2 years ago
Hello : )
i am an absolute beginner and actually trying to achieve the following: My processing sketch should
load an image and display its color values and display the color in the left upper corner. This works
perfectly by but what i really want, is that the sketch begins reading in the upper left corner, proceeds
to the upper right corner and then does the same thing with the next line and so on. (For better understanding:
The image consists of 8x8 color swatches which are 50 x 50 px each). I am not good at programming and i was
not able to code the loops i need for this. I would be really grateful if you can help me with this idea.
Below the code i have done so far (with parts of the first loop which i was not able to finish)
- PImage Bilddatei;
- void setup() {
- size(400, 400);
- Bilddatei = loadImage("400x400grid.jpg");
- image(Bilddatei, 0, 0);
- }
- void draw() {
- int positionX=320;
- int positionY=50;
- float y=0;
- // var anlegen
- while (y <= 400) {
- color Quadrat = Bilddatei.get(positionX,positionY);
- fill(Quadrat);
- rect(0,0, 100, 100);
- y = y + 20;
- }
- }
Thank you so much! tm
1