Deviant Pixels
- maiguzman28
- Jun 25, 2020
- 1 min read
Updated: Jul 16, 2020

So last week we started experimenting with images. I have to be honest, I felt very lost during that session and did not understand so much of the topic. I got lost very quickly and never really catch up. But I watched a tutorial on that and started to exepriment on my own, little by little. Suddenly it was not so scary:

I uploaded successfully the corona image. Yeay!
Adding the functions mouseX and mouse Y allowed me to do this:
And adding the tint function and playing a little with it made the image look like this:

After that I tried the excercise in the script:

And this is how it looks without a Stroke:

And to continue with the excercises:

But I am having trouble with the background, even though it should have been the easiest thing.
It turns out all I needed to do is actually not display the image at all...

And I played a little with the size of the circles in order to make the image more accurate:

And I also tried to play with colors and this happened:

PImage corona;
void setup()
{
size(600, 600);
background(255);
//load the image
corona = loadImage("corona.jpg");
//display the image at position 0,0
//image(corona,0,0);
//Size of pixels
int widthNewPixel=10;
int heightNewPixel=10;
//Loop for each line and row
for (int x=0; x<width; x=x+widthNewPixel) {
for (int y=0; y<height; y=y+heightNewPixel) {
//get color from x and y
color c = corona.get(x, y);
float b = brightness(c);
noStroke();
fill(c);
if(b<85){
fill(255,0,0);
ellipse(x, y, 5, 5);
} else if (b>85 && b>170){
fill(0,255,0);
ellipse(x,y,5,5);
}else {
fill(0,0,255);
ellipse(x,y,5,5);
}
}
}
}
Comments