Why is my result stretched?

https://www.openprocessing.org/sketch/1037242 here is my code and this is the tutorial I followed https://www.youtube.com/watch?v=rNqaw8LT2ZU and this is the original image

Your canvas size and image size is different, so when you go over every pixel of your image, you need to refer to img.width and img.height instead of canvas width and height.

for (let x = 0; x < img.width; x = x + 1) {
    for (let y = 0; y < img.height; y = y + 1) {
		 let index = (x + y * img.width) * 4;
    }
}
1 Like

thx <3 Iā€™m still very new