Blob Blame History Raw
#! /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 -target1=45.0 -target2=59.5 -target3=56.5 - testimg.ppm


# Note that "-rowsperstrip=1" does not work
pnmtotiffcmyk -rowsperstrip 1 -lsb2msb testimg.ppm > ${output_tiff} && \
  tifftopnm -respectfillorder -byrow  ${output_tiff} | \
  pnmpsnr -target1=45.0 -target2=59.5 -target3=56.5 - testimg.ppm


pnmtotiffcmyk -packbits testimg.ppm > ${output_tiff} && \
  tifftopnm -byrow ${output_tiff} | \
  pnmpsnr -target1=45.0 -target2=59.5 -target3=56.5 - testimg.ppm


pnmtotiffcmyk -lzw testimg.ppm > ${output_tiff} && \
  tifftopnm -byrow ${output_tiff} | \
  pnmpsnr -target1=45.0 -target2=59.5 -target3=56.5 - testimg.ppm


pnmtotiffcmyk -lzw -predictor 2 testimg.ppm > ${output_tiff} && \
  tifftopnm -respectfillorder -byrow ${output_tiff} | \
  pnmpsnr -target1=45.0 -target2=59.5 -target=56.5 - testimg.ppm


rm ${output_tiff}