Pipe STDOUT to an image?
How to convert text to an image has already been answered here: https://stackoverflow.com/questions/3826379/image-magick-converting-text-to-image-is-there-a-way-to-center-the-text-to-t That answer provides various variants on how to do this with the ImageMagick tools.
Please note: This will only work reliably if the output of your command is plain text.
If there is any sort of fancy formatting (like ncurses stuff) the results can be quite unpredictable.
Partial answer, listing some possibilities:
There is a number of progams you can use to render text to images, for example:
-
convert
from ImageMagick/GraphicsMagick -
pbmtext
from NetPBM, renders to Portable Bitmap -
paps
, renders to Postscript using Pango -
enscript
, renders to Postscript
But converting a different format to PNG shouldn't be a problem.
Of these, only enscript
supports colors via "special escapes". These are not the same as the terminal escapes, so you'll to convert them with awk/perl etc.
Another option is to render the whole thing in an xterm, and screenshot.
As you can see, all of these are quite complicated, at will require non-trivial effort to make them work. Which is no surprise, because basically you want to replicate the whole rendering part of your terminal.
It might be easier to just store the output itself, and retrieve it in a terminal when you want to look at it.