You can do it easily in TIFFs or PPMs. I'd say, go with PPMs. I've never dealt with direct BMP output, but I suspect it'd be easy, too (but you can read a PPM with GIMP and then export it to BMPs anyway, so, whichever).
PPM is easiest.
Lets suppose you want a 1024x768 desktop background, full color. You'll need 3 color values per pixel, each one takes up two digits of hex, so,you'll need a total of 4,718,592 hex digits of pi. Except that's not quite right, because the opening 3 is probably going to be 000003 on the first pixel, so you'll only need 4,718,586 more hex-digits, to go with the decimal expansion.
To write the actual file, first, write the header, which is the ASCII character string of:
- Code: Select all
Then, stop writing to the file in ASCII, and start writing in raw bytes. Write the numbers 0,0,3 to the file at first; then get the remaining 2,359,293 bytes from the program you're using to calculate pi.
Close the file, saved as pi.ppm, and open it with the GIMP. Voila, done.