I am quite new to Processing, but still amazed by the simplicity of the language.
Still, I would like to reproduce an example from the tutorial "Images and Pixels".
I can load an image and show it on the screen using the image command, but when I try to show it on the screen pixel by pixel as in the example, all I get is some strange lines, completely different from my original image.
I am using Processing 1.5 on Windows 7.
I post my code below.
Thanks,
Samuel
PImage img;
void setup() {
size(600, 500);
img = loadImage("Sachan 2.png");
}
void draw() {
loadPixels();
// Since we are going to access the image's pixels too
img.loadPixels();
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
int loc = x + y*width;
// The functions red(), green(), and blue() pull out the 3 color components from a pixel.