0, 1, ... N-1, N, N+1, ... 2*N-1, 2*N, 2*N+1, ... 3*N-1, ... (M-1)*N, (M-1)*N+1, ... M*N-1
P1 # feep.pbm 24 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 1 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
P2 # feep.pgm 24 7 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 3 3 3 0 0 7 7 7 7 0 0 11 11 11 11 0 0 15 15 15 15 0 0 3 0 0 0 0 0 7 0 0 0 0 0 11 0 0 0 0 0 15 0 0 15 0 0 3 3 3 0 0 0 7 7 7 0 0 0 11 11 11 0 0 0 15 15 15 15 0 0 3 0 0 0 0 0 7 0 0 0 0 0 11 0 0 0 0 0 15 0 0 0 0 0 3 0 0 0 0 0 7 7 7 7 0 0 11 11 11 11 0 0 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
P3 # feep.ppm 4 4 15 0 0 0 0 0 0 0 0 0 15 0 15 0 0 0 0 15 7 0 0 0 0 0 0 0 0 0 0 0 0 0 15 7 0 0 0 15 0 15 0 0 0 0 0 0 0 0 0
$ hexdump feepb.pbm 0000000 5034 0a32 3420 370a 0000 0079 e79e 4104 0000010 1271 c71e 4104 1041 e790 0000 0000
$ od -c feepb.pbm 0000000 P 4 \n 2 4 7 \n \0 \0 \0 y 347 236 A 004 0000020 022 q 307 036 A 004 020 A 347 220 \0 \0 \0
$ hexdump feepb.pgm 0000000 5035 0a32 3420 370a 3235 350a 0000 0000 0000010 0000 0000 0000 0000 0000 0000 0000 0000 0000020 0000 0000 0033 3333 3300 0077 7777 7700 0000030 00bb bbbb bb00 00ff ffff ff00 0033 0000 0000040 0000 0077 0000 0000 00bb 0000 0000 00ff 0000050 0000 ff00 0033 3333 0000 0077 7777 0000 0000060 00bb bbbb 0000 00ff ffff ff00 0033 0000 0000070 0000 0077 0000 0000 00bb 0000 0000 00ff 0000080 0000 0000 0033 0000 0000 0077 7777 7700 0000090 00bb bbbb bb00 00ff 0000 0000 0000 0000 00000a0 0000 0000 0000 0000 0000 0000 0000 0000
$ hexdump feepb.ppm 0000000 5036 0a34 2034 0a32 3535 0a00 0000 0000 0000010 0000 0000 ff00 ff00 0000 00ff 7700 0000 0000020 0000 0000 0000 0000 0000 ff77 0000 00ff 0000030 00ff 0000 0000 0000 0000 0000
#!/usr/bin/env python # ex01.py ... make 16x16 gray scale image f = open('ex01.pgm', 'w') print >> f, 'P2' print >> f, '16 16' print >> f, '255' for y in range(16): for x in range(16): print >> f, 16*y + x , print >> f f.close()
$ file feepb.gif feepb.gif: GIF image data, version 87a, 24 x 7 $ hexdump feepb.gif 0000000 4749 4638 3761 1800 0700 8000 0000 0000 0000010 ffff ff2c 0000 0000 1800 0700 0002 1c8c 0000020 8fa9 080d e65e 88d0 c124 4fbe b366 eb69 0000030 e0d6 31d8 c98c e3c2 b648 0100 3b00
$ file feepb.png feepb.png: PNG image data, 24 x 7, 1-bit grayscale, non-interlaced $ hexdump feepb.png 0000000 8950 4e47 0d0a 1a0a 0000 000d 4948 4452 0000010 0000 0018 0000 0007 0100 0000 003a 8cb0 0000020 1b00 0000 2249 4441 5408 9963 f8ff ff3f 0000030 439b 4422 c3be df6f 19fa 2c1e 02e9 f70c 0000040 fb24 f219 80e2 00d2 6f0f 346f 79ad cd00 0000050 0000 0049 454e 44ae 4260 8200
$ file feepb.jpg feepb.jpg: JPEG image data, JFIF standard 1.01 $ hexdump feepb.jpg | head -2 0000000 ffd8 ffe0 0010 4a46 4946 0001 0100 0001 0000010 0001 0000 ffdb 0043 0008 0606 0706 0508
P2 2 2 3 0 1 2 3