Ko je celotna naloga izracunana shranimo datoteko v formatu PPM.
static int
* save_scene ()
* {
* FILE *f;
* int i;
if ((f = fopen (outputFileName, "w")) == NULL)
* {
* perror(outputFileName);
* return -1;
* }
fprintf(f, "P6\n
%
d
%
d\n255\n", width, height); /*
raw PPM format */
* for (i = jobnext = 0 ; i < njobs; i++)
* {
* int y1, y2;
* y1 = jobnext++ * height; /*
* y1 /= njobs; /*
* y2 = jobnext * height; /*
y1 <= y && y < y2 */
* y2 /= njobs; /*
y1 is in tile, but y2 is NOT */
fwrite(image[i], (y2 - y1) * width * 3, 1, f);
* }
fflush (f);
* fclose (f);
* return 0;
* }