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
|
#! /bin/bash
# This script tests: pnmtotiffcmyk tifftopnm
# Also requires: pnmpsnr
# Failure message
## If this test fails, the cause may be a problem in the TIFF library.
tmpdir=${tmpdir:-/tmp}
tartan_ppm=${tmpdir}/tartan.ppm
output_ppm=${tmpdir}/output.ppm
output_tiff=${tmpdir}/output.tiff
# Note that color images cannot be tested by the roundtrip method
# because of approximations incurred by converting from RGB to CMYK
pnmtotiffcmyk testimg.ppm > ${output_tiff} && \
tifftopnm -headerdump -byrow ${output_tiff} | \
pnmpsnr -machine - testimg.ppm | \
awk '{printf("%3d %.2f %.2f %.2f\n", NF,
$1>45.0 ? 1000.00 : $1,
$2>59.5 ? 1000.00 : $2,
$3>56.5 ? 1000.00 : $3) }'
# Note that "-rowsperstrip=1" does not work
pnmtotiffcmyk -rowsperstrip 1 -lsb2msb testimg.ppm > ${output_tiff} && \
tifftopnm -respectfillorder -byrow ${output_tiff} | \
pnmpsnr -machine - testimg.ppm | \
awk '{printf("%3d %.2f %.2f %.2f\n", NF,
$1>45.0 ? 1000.00 : $1,
$2>59.5 ? 1000.00 : $2,
$3>56.5 ? 1000.00 : $3) }'
pnmtotiffcmyk -packbits testimg.ppm > ${output_tiff} && \
tifftopnm -byrow ${output_tiff} | \
pnmpsnr -machine - testimg.ppm | \
awk '{printf("%3d %.2f %.2f %.2f\n", NF,
$1>45.0 ? 1000.00 : $1,
$2>59.5 ? 1000.00 : $2,
$3>56.5 ? 1000.00 : $3) }'
pnmtotiffcmyk -lzw testimg.ppm > ${output_tiff} && \
tifftopnm -byrow ${output_tiff} | \
pnmpsnr -machine - testimg.ppm | \
awk '{printf("%3d %.2f %.2f %.2f\n", NF,
$1>45.0 ? 1000.00 : $1,
$2>59.5 ? 1000.00 : $2,
$3>56.5 ? 1000.00 : $3) }'
pnmtotiffcmyk -lzw -predictor 2 testimg.ppm > ${output_tiff} && \
tifftopnm -respectfillorder -byrow ${output_tiff} | \
pnmpsnr -machine - testimg.ppm | \
awk '{printf("%3d %.2f %.2f %.2f\n", NF,
$1>45.0 ? 1000.00 : $1,
$2>59.5 ? 1000.00 : $2,
$3>56.5 ? 1000.00 : $3) }'
rm ${output_tiff}
|