Apple - Preview image from pipe

Try

produce_image | open -a Preview.app -f

(To be honest, I was quite surprised to learn that this works)


This displays image data from STDIN in the terminal in iTerm 2 (https://www.iterm2.com/documentation-images.html):

cat file.png|printf "\e]1337;File=inline=1:$(base64)\a\n"

The function below displays one or more images in the terminal.

ima(){ local f;for f;do printf "\e]1337;File=inline=1:$(if [[ $f = *://* ]];then curl -Ls "$f";else cat -- "$f";fi|base64)\a\n";done;}

To display images at a maximum height of 20 rows, add ;height=20.