What is PBM?
PBM is Netpbm's bilevel format - one bit per pixel, pure black or pure white, nothing in between. It is used for scanned documents, fax-era imagery and dithered art, and its packing convention surprises people: a 1 bit means black.
What is PGM?
PGM is the greyscale member of the Netpbm family: a three-line header, then one brightness value per pixel with no compression. It is what image-processing courses, OCR pipelines and computer-vision tools pass around when they want a format with no decoder in the way.