How to make grid of image pixels in nested loop

i have image pixel length from 0 to 10000 . i want to make a grid of 100*100 in nested loop.
please tell me how can i do that…

  for (int y=0; y<img.height; y++)
  {
    for (int x=0; x<img.width; x++)

    {
      int i= x+y*width;
     
      
     if ((i+1)%100 == 1) {
        
        print("\n");
       
      }
}
}

You can use resize on your image to make it small

Then do the for loop

Hey there the_nish,

Have you gone through the Images and Pixels tutorial yet? About halfway, at the example called Displaying the pixels of an image, they show how the stored pixels (your 0 to 10.000 situation) gets converted to an image (the 100x100 grid you want to make).

Does that help?

2 Likes