PPM image format
The PPM image format is an evolution of the PBM which was monochrome, PPM has RGB colors.
I use PPM images in P3 or P6 formats because they are easy to generate in programs and are supported by image magick, gimp, geeqie and many other software.
The P3 format is regular text like this:
P3
3 2
255
255 0 0
0 255 0
0 0 255
255 255 0
255 255 255
0 0 0
The first 3 lines are the header and the other lines are the pixel RGB data. Line 2 is the image size: width height. Line 3 is the color count per channel.
The P6 format has the header in text and the pixel data in binary form.
P6
3 2
255
RGB bytes
With my sheepy system, I generate the image above in P6 format like this:
u8 buf[] = {255,0,0, 0,255,0, 0,0,255, 255,255,0, 255,255,255, 0,0,0};
cleanFileP(f) = fopen("testp6.ppm", "w");
writeFileG("P6\n"
"3 2\n"
"255\n", f);
writeLStream(f, buf, 18);
I use Verilator to develop my GPU and to see the images generated by the GPU, I convert the data on the display bus to PPM images. I print the values of the display bus in the log or store the pixel data in a memory and dump the memory.