/usr/bin/anytopnm is in netpbm 2:10.0-15ubuntu2.
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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | #!/bin/sh
#
# anytopnm - attempt to convert an unknown type of image file to a P?M file.
#
# 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 [ $# -gt 1 ] ; then
echo "Usage: $0 infilename > outfilename.pnm" 1>&2
echo " $0 - < infilename > outfilename.pnm" 1>&2
echo " This will convert the input file into a PNM file" 1>&2
echo " It automatically determines the format of the input file" 1>&2
echo " with the 'file' command, and acts accordingly" 1>&2
echo " If the infilename is a '-', uses standard input" 1>&2
exit 1
fi
tmpdir=$(mktemp -d -t anytopnm.XXXXXXXXXX) || exit 1 #219019
# Take out all spaces
# Find the filename extension for last-ditch efforts later
fileextension=`echo "$1" | awk '{gsub(" ","");gsub(".*\\\\.",".");print}'`
# Sanitize the filename by making our own temporary files as safely as
# possible.
file="$tmpdir/atn.stdin"
if [ $# -eq 0 -o "$1" = "-" ] ; then
cat > "$file"
else
if [ ! -e "$1" ] ; then
echo "$0: $1: No such file" 1>&2
exit 1
fi
if [ ! -f "$1" ] ; then
echo "$0: $1: Not a file" 1>&2
exit 1
fi
if [ ! -r "$1" ] ; then
echo "$0: $1: Not a readable file" 1>&2
exit 1
fi
if [ -z "$1" ] ; then
echo "$0: $1: Empty file" 1>&2
exit 1
fi
cat < "$1" > "$file"
fi
filetype=`file "$file" | cut -d: -f2-`
case "$filetype" in
*PBM* | *PGM* | *PPM* )
cat "$file"
;;
*uuencoded* )
newfile="$tmpdir/atn.decode"
(echo begin 600 $newfile; sed 1d < "$file") | uudecode # #204890
anytopnm "$newfile"
;;
*bzip2*compressed*data* )
bzip2 -dk < "$file" | anytopnm -
;;
*bzip*compressed*data* )
bzip -dk < "$file" | anytopnm -
;;
*gzip*compressed*data* )
gzip --decompress --to-stdout < "$file" | anytopnm -
;;
*compress* )
uncompress -c < "$file" | anytopnm -
;;
*btoa* )
atob < "$file" | anytopnm -
;;
*Sun* | *rasterfile* )
rasttopnm "$file"
;;
*GIF* )
giftopnm "$file"
;;
*TIFF* )
tifftopnm "$file"
;;
*IFF*ILBM* )
ilbmtoppm "$file"
;;
*Lisp* )
lispmtopgm "$file"
;;
*PC*Paintbrush* )
pcxtoppm "$file"
;;
*Bennet* )
ybmtopbm "$file"
;;
*pixmap*image*text* )
xpmtoppm < "$file"
;;
# This has to come after all other 'text' files, or you may be
# disappointed.
*text* )
pbmtext -builtin fixed < "$file"
;;
*JPEG* | *JFIF* )
jpegtopnm "$file"
;;
*PNG* )
pngtopnm "$file"
;;
*MicroDesign* )
mdatopbm -d -- "$file"
;;
*PC*bitmap*data* )
bmptoppm "$file"
;;
* )
# Can't figure out the file type from the magic number,
# try the extension.
case "$fileextension" in
*.pbm | *.pbm.* | *.pgm | *.pgm.* | *.ppm | *.ppm.* )
cat "$file"
;;
*.x | *.x.* | *.xbm | *.xbm.* | *.x10bm | *.x10bm.* | \
*.x11bm | *.x11bm.* | *.bitmap | *.bitmap.* )
xbmtopbm "$file"
;;
*.r | *.r.* | *.rast | *.rast.* )
rasttopnm "$file"
;;
*.mac | *.mac.* | *.macp | *.macp.* )
macptopbm "$file"
;;
*.g3 | *.g3.* | *.fax | *.fax.* )
g3topbm "$file"
;;
*.xwd | *.xwd.* | *.x10wd | *.x10wd.* | *.x11wd | *.x11wd.* )
xwdtopnm "$file"
;;
*.brush | *.brush.* )
brushtopbm "$file"
;;
*.img | *.img.* )
gemtopbm "$file"
;;
*.pcx | *.pcx.* )
pcxtoppm "$file"
;;
*.pic | *.pic.* | *.pict | *.pict.* | *.pict2 | *.pict2.* )
picttoppm "$file"
;;
*.tif | *.tif.* | *.tiff | *.tiff.* )
tifftopnm "$file"
;;
*.fs | *.fs.* | *.face | *.face.* )
fstopgm "$file"
;;
*.hips | *.hips.* )
hipstopgm "$file"
;;
*.fits | *.fits.* )
fitstopnm "$file"
;;
*.gif | *.gif.* )
giftopnm "$file"
;;
*.iff | *.iff.* | *.ilbm | *.ilbm.* )
ilbmtoppm "$file"
;;
*.lispm | *.lispm.* )
lispmtopgm "$file"
;;
*.mtv | *.mtv.* )
mtvtoppm "$file"
;;
*.qrt | *.qrt.* )
qrttoppm "$file"
;;
*.tga | *.tga.* | *.targa | *.targa.* )
tgatoppm "$file"
;;
*.xim | *.xim.* )
ximtoppm "$file"
;;
*.xpm | *.xpm.* | *.xpm2 | *.xpm2.* )
xpmtoppm "$file"
;;
*.pi1 | *.pi1.* )
pi1toppm "$file"
;;
*.pi3 | *.pi3.* )
pi3topbm "$file"
;;
*.spu | *.spu.* )
sputoppm "$file"
;;
*.spc | *.spc.* )
spctoppm "$file"
;;
*.ybm | *.ybm.* | *.face | *.face.* )
ybmtopbm "$file"
;;
*.JPEG | *.jpeg | *.jpg | *.JPG )
jpegtopnm "$file"
;;
*.png | *.PNG )
pngtopnm "$file"
;;
*.mda | *.mdp )
mdatopbm -d -- "$file"
;;
* )
echo "$0: unknown file type: $filetype" 1>&2
exit 1
;;
esac
;;
esac
if [ -d "$tmpdir" ] ; then
rm -rf "$tmpdir";
fi
exit 0
|