Read the PNM type before judging the picture
PNM can refer to a monochrome bitmap, grayscale image, or color pixmap. The header indicates how samples should be interpreted. A file that appears black and white may be correct for its subtype rather than a failed color conversion.
Plain-text and binary encodings store pixel values differently. A receiving tool normally reads the header, but custom scripts may make assumptions. Confirm the converted PNG matches the intended color model and dimensions.