for($x=1;$x<=$width;$x++) { for($y=1;$y<=$height;$y++) { $pixel=getPixel($image, $x, $y); //do something } }
What this will do is find every pixel in every column.
i=iteration pixel coordinate = (x,y)
For a 5 x 5 image, the iteration will look like this:
i1 = (1,1) i2 = (1,2) i3 = (1,3) i4 = (1,4) i5 = (1,5) i6 = (2,1) i7 = (2,2) i8 = (2,3) i9 = (2,4) i10 = (2,5) i11 = (3,1) i12 = (3,2) i13 = (3,3) i14 = (3,4) i15 = (3,5) i16 = (4,1) i17 = (4,2) i18 = (4,3) i19 = (4,4) i20 = (4,5) i21 = (5,1) i22 = (5,2) i23 = (5,3) i24 = (5,4) i25 = (5,5)
source share