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
|
#! /bin/bash
# This script tests: pamtotiff tifftopnm
# Also requires: ppmpat pampick ppmtopgm
# Failure message
## If this test fails, the cause may be a problem in the TIFF library.
tmpdir=${tmpdir:-/tmp}
tartan_ppm=${tmpdir}/tartan.ppm
gingham_ppm=${tmpdir}/gingham.ppm
argylecolor_ppm=${tmpdir}/argyle1.ppm
argylegray_ppm=${tmpdir}/argyle2.ppm
multiimage_tiff=${tmpdir}/multiimage.ppm
# PPM image
# Should print 1926073387 101484 five times
echo PPM-rose
pamtotiff testimg.ppm | tifftopnm -headerdump | cksum
pamtotiff -truecolor testimg.ppm -output ${multiimage_tiff} && \
tifftopnm ${multiimage_tiff} -byrow | cksum
pamtotiff -truecolor -packbits testimg.ppm | tifftopnm | cksum
pamtotiff -truecolor -rowsperstrip=2 testimg.ppm | tifftopnm | cksum
pamtotiff -truecolor -lsb2msb testimg.ppm | \
tifftopnm -respectfillorder | cksum
# PPM image with six colors
# Should print 1646869394 29498 four times
echo PPM-6
ppmpat -tartan -color=rgb:0/8/8,rgb:8/f/8,rgb:f/f/0 108 91 | \
tee ${tartan_ppm} | cksum
pamtotiff -truecolor ${tartan_ppm} | tifftopnm | cksum
pamtotiff ${tartan_ppm} | tifftopnm -respectfillorder | cksum
pamtotiff ${tartan_ppm} -append -output ${multiimage_tiff} && \
tifftopnm ${multiimage_tiff} | pampick 1 | cksum
# PPM image with two colors
# Should print 3743909631 14836 four times
echo PPM-2
ppmpat -argyle2 -color=rgb:0/0/0,rgb:f/8/f,rgb:0/0/0 61 81 | \
tee ${argylecolor_ppm} | cksum
pamtotiff -indexbits=2 ${argylecolor_ppm} -append -output ${multiimage_tiff} && \
tifftopnm ${multiimage_tiff} | pampick 2 | cksum
pamtotiff -indexbits=1 ${argylecolor_ppm} | tifftopnm | cksum
pamtotiff -indexbits=1 -g4 ${argylecolor_ppm} | tifftopnm | cksum
# PPM image with six shades of gray
# pamtotiff detects the absence of colors and produces a grayscale
# tiff image unless -color is specified
# Pipeline output is PGM unless -color is specified
# Should print 603974118 4954 six times
echo PPM-gray
ppmpat -gingham3 -color=rgb:0/0/0,rgb:ff/ff/ff,rgb:0/0/0 61 81 | \
tee ${gingham_ppm} | ppmtopgm | cksum
pamtotiff -color ${gingham_ppm} | tifftopnm | cksum
pamtotiff -indexbits=1,2 -mb -fill ${gingham_ppm} | tifftopnm | cksum
pamtotiff -indexbits=1,2 -mw ${gingham_ppm} | tifftopnm | cksum
pamtotiff -indexbits=1,2,4,8 -mb ${gingham_ppm} | tifftopnm | cksum
pamtotiff -mb ${gingham_ppm} -append -output ${multiimage_tiff} && \
tifftopnm ${multiimage_tiff} | pampick 3 | cksum
# PPM image with two shades of gray (bilevel)
# pamtotiff detects the absence of colors and produces a grayscale
# tiff image unless -color is specified
# Pipeline output is PGM unless -color is specified
# Should print 1001018459 4954 four times
echo PPM-bilevel-black-white
ppmpat -argyle2 -color=rgb:0/0/0,rgb:ff/ff/ff,rgb:0/0/0 61 81 | \
tee ${argylegray_ppm} | ppmtopgm | cksum
pamtotiff -color -fill ${argylegray_ppm} | tifftopnm | cksum
pamtotiff -indexbits=1 -mw ${argylegray_ppm} | tifftopnm | cksum
pamtotiff -mb ${argylegray_ppm} -append -output ${multiimage_tiff} && \
tifftopnm ${multiimage_tiff} | pampick 4 | cksum
# PBM image
# Should print 2425386270 41 three times
echo PBM
pamtotiff testgrid.pbm | tifftopnm | cksum
pamtotiff -g3 -fill testgrid.pbm | tifftopnm | cksum
pamtotiff -g4 -mb testgrid.pbm -append -output ${multiimage_tiff} && \
tifftopnm ${multiimage_tiff} | pampick 5 | cksum
# Extract individual images from multi-image tiff file
echo "Extract from multi-image TIFF"
tifftopnm ${multiimage_tiff} | pampick 0 | cksum
tifftopnm ${multiimage_tiff} | pampick 1 | cksum
tifftopnm ${multiimage_tiff} | pampick 2 | cksum
tifftopnm ${multiimage_tiff} | pampick 3 | cksum
tifftopnm ${multiimage_tiff} | pampick 4 | cksum
rm ${tartan_ppm} ${gingham_ppm} ${argylecolor_ppm} \
${argylegray_ppm} ${multiimage_tiff}
|