3 ms·
I first heard about this concept in the early 1990s from netpbm (then called pbmtools). The exact language seems to have been removed from the current manual[1
by rwmj 3y ago
I first heard about this concept in the early 1990s from netpbm (then called pbmtools). The exact language seems to have been removed from the current manual[1] but the basic idea was that if you have N image formats, you can either write NxN tools to convert between them, or you can have a few common image formats (ie. pbm - bitmap, pgm - greyscale and ppm - fullcolour) and then write 2xN tools to convert between the universe of all image formats and the common formats. You then use Unix pipes to connect the tools together.
[1] https://netpbm.sourceforge.net/doc/ https://netpbm.sourceforge.net/doc/
- nottorp 3y agoExcept 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.
- ramses0 3y agoI miss a bit some of the old `xxx2yyy` programs. It's tempting to consider: FILE.csv.html.pdf.zip ...`csv2html | html2pdf | pdf2zip`, and vice-versa... how possible is it to make the pipeline reversible, eg: `zip2pdf | pdf2html | html2csv`, or in the absence of "reversibility", could you simply shortcut and get straight back to the original `*.csv`?