pamfix

Fix errors in PAM, PBM, PGM and PPM files. See also: pamfile, pamvalidate. More information: https://netpbm.sourceforge.net/doc/pamfix.html.

pamfix -truncate path/to/corrupted.ext} > {{path/to/output.ext

pamfix -clip path/to/corrupted.ext > path/to/output.ext

pamfix -changemaxval path/to/corrupted.pam|pbm|pgm|ppm > path/to/output.pam|pbm|pgm|ppm