1#!/usr/local/bin/bash
2# This script tests: pnmtotiffcmyk tifftopnm
3# Also requires: pnmpsnr
4
5# Failure message
6## If this test fails, the cause may be a problem in the TIFF library.
7
8tmpdir=${tmpdir:-/tmp}
9tartan_ppm=${tmpdir}/tartan.ppm
10output_ppm=${tmpdir}/output.ppm
11output_tiff=${tmpdir}/output.tiff
12
13# Note that color images cannot be tested by the roundtrip method
14# because of approximations incurred by converting from RGB to CMYK
15
16pnmtotiffcmyk testimg.ppm > ${output_tiff} && \
17  tifftopnm -headerdump -byrow ${output_tiff} | \
18  pnmpsnr -target1=45.0 -target2=59.5 -target3=56.5 - testimg.ppm
19
20
21# Note that "-rowsperstrip=1" does not work
22pnmtotiffcmyk -rowsperstrip 1 -lsb2msb testimg.ppm > ${output_tiff} && \
23  tifftopnm -respectfillorder -byrow  ${output_tiff} | \
24  pnmpsnr -target1=45.0 -target2=59.5 -target3=56.5 - testimg.ppm
25
26
27pnmtotiffcmyk -packbits testimg.ppm > ${output_tiff} && \
28  tifftopnm -byrow ${output_tiff} | \
29  pnmpsnr -target1=45.0 -target2=59.5 -target3=56.5 - testimg.ppm
30
31
32pnmtotiffcmyk -lzw testimg.ppm > ${output_tiff} && \
33  tifftopnm -byrow ${output_tiff} | \
34  pnmpsnr -target1=45.0 -target2=59.5 -target3=56.5 - testimg.ppm
35
36
37pnmtotiffcmyk -lzw -predictor 2 testimg.ppm > ${output_tiff} && \
38  tifftopnm -respectfillorder -byrow ${output_tiff} | \
39  pnmpsnr -target1=45.0 -target2=59.5 -target=56.5 - testimg.ppm
40
41
42rm ${output_tiff}
43