If you have a .pnm format image (whatever the source), you can convert it into a jpeg with a command like
cjpeg -quality 95 fred.pnm > fred.jpg
cjpeg is compiled along with AFNI (although it comes from the Independent JPEG Group - see file afni_src/jpeg-6b/README for details). If you want to convert to other formats, most Linux systems have the netpbm programs installed. For example:
ppmtobmp -windows fred.pnm > fred.bmp
will create a MS Windows BMP file. (This is pretty much how AFNI does it from the image viewer windows, too.)
bob cox