I want to write a C program that produces 1000x1000
.ppm
file, showing a vertical gradient from black(left) to white (right). Now, if the picture would be 256x256
it would be easy:
P3
256 256
255
0 0 0 1 1 1 2 2 2 .... 255 255 255
0 0 0 1 1 1 2 2 2 .... 255 255 255
.
.
.
0 0 0 1 1 1 2 2 2 .... 255 255 255
Thing is, since it must be 1000x1000 (exceeding 255), I'm not sure what formula I should follow to get a perfect gradient. Any ideas?