3 ms·
Except in that case you're converting to and from an uncompressed buffer... that could be in ram and not use a file format at all?
by nottorp 3y ago
Except in that case you're converting to and from an uncompressed buffer... that could be in ram and not use a file format at all?
- rwmj 3y agoIt'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.