In theory PAM can replace the PNM formats, and it "officially" supports 16 bits (MAXVAL 65535) instead of only 8 bits (MAXVAL 255) for gray maps and pix maps. Of course folks use 16 bits also for P2/P5 (PGM) and P3/P6 (PPM), so that's not very interesting. The rather odd P1/P4 format (PBM) with one bit per pixel (FFmpeg pixel_fmt monob, 1 = black) ends up as a MAXVAL=1 gray map in PAM (pixel_fmt monow, 1 = white, one byte per pixel).
The interesting PAM feature is RGBA (DEPTH=4) with an alpha channel, and DEPTH=2 for a gray map with transparency. I use FFmpeg to convert PNG to PAM, decode this in a script, "do stuff" (e.g., extract tiles from a grid in a Freeciv tileset), and eventually I convert the output PAM(s) with FFmpeg back to PNG(s). If XnView could display PAM I could skip some PNG -> PAM -> PNG -> PAM -> PNG steps.
