2 ms·
It's much more useful to have a real file format. For example, you can generate images from your own code by doing this (with a bit more shell quoting and erro
by rwmj 3y ago
It's much more useful to have a real file format.
For example, you can generate images from your own code by doing this (with a bit more shell quoting and error checking in the real code):
fp = popen ("ppmtojpeg > output.jpg", "w");
fprintf (fp, "P3 1024 1024 255\n");
for (y = 0; y < 1024; ++y)
for (x = 0; x < 1024; ++x)
fprintf (fp, "%d %d %d\n", 255*r[y][x], 255*g[y][x], 255*b[y][x]);
fclose (fp);
- frutiger 3y agoThis is the first time I have seen anyone popen’ing a pipeline like that, and writing to its stdin. Bravo.