TIl how pbm, pgm, ppm, pam images could be previewed on macOS:

pnmtopng feep.ascii.p5.pgm | open -f -a Preview

Preview of netpbm file with means of netpbm on macOS is important as macOS renders these file often incorrectly. E.g. as on following screenshot correct preview is on the bottom.

Finder screenshot with wrongly rendered pgm file

Analogous pipe on Ubuntu will look like pnmtoxwd /Users/valeriyvan/Downloads/surf.ascii.pgm | xwud. This works on macOS as well if X Windows is installed.

Found dithering command line in netpbm - pamditherbw: pamditherbw baboon.ascii.pgm | open -f -a Preview.

This is the result of running jpegtopnm ~/Desktop/me.jpg | ppmtopgm - | pamditherbw - | pnmtopng - | open -f -a Preview: me dithered with pamditherbw