/usr/bin/pnmtopgm is in ivtools-bin 1.2.11a1-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | #!/bin/sh
#
# pnmtopgm - derived from anytopnm
#
# Copyright 1998 Vectaport Inc.
# Copyright (C) 1991 by Jef Poskanzer.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted, provided
# that the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation.  This software is provided "as is" without express or
# implied warranty.
if [ ! $# = 1 ] ; then
    echo "usage: $0 <file>" 1>&2
    exit 1
fi
origfile="$1"
file="$origfile"
tmpfiles=""
    filetype=`file "$file"`
    case "$filetype" in
	*PBM* )
	pnmdepth 255 "$file"
	exit 0
	;;
	*PGM* )
	cat "$file"
	exit 0
	;;
	 *PPM* )
	ppmtopgm "$file"
	exit 0
	;;
    esac
exit -1
 |