about summary refs log tree commit diff
path: root/test/ppmmix.test
blob: 451aa8be466ffc77b856db0d0235077602ecd8e2 (plain) (blame)
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
#! /bin/bash
# This script tests: ppmmix
# Also requires: pamdepth pamenlarge pamsumm pbmmake
# Also requires: pgmtopgm pnminvert ppmtopgm

# Print a pretty checkerboard pattern
${PBM_BINPREFIX}pbmmake -g 8 8 | \
 ${PBM_BINPREFIX}pgmtopgm > ${tmpdir}/a1.pgm &&
${PBM_BINPREFIX}pbmmake -g 2 2 | ${PBM_BINPREFIX}pamenlarge 4 | \
 ${PBM_BINPREFIX}pgmtopgm > ${tmpdir}/a2.pgm &&
${PBM_TESTPREFIX}ppmmix 0.75 ${tmpdir}/a1.pgm ${tmpdir}/a2.pgm -plain | \
 ${PBM_BINPREFIX}ppmtopgm | ${PBM_BINPREFIX}pamdepth 3 -plain &&
rm ${tmpdir}/a1.pgm ${tmpdir}/a2.pgm

# Mix image with itself.
# Output should match input regardless of ratio. 
for i in 0 0.5 0.6 1
do 
${PBM_TESTPREFIX}ppmmix $i testimg.ppm testimg.ppm | cksum
done

# Mix image with its own inverse.
# Output should be a monotone gray sheet.
${PBM_BINPREFIX}pnminvert testimg.ppm | ${PBM_TESTPREFIX}ppmmix .5 \
    testimg.ppm - | tee ${tmpdir}/a3.ppm | \
  ${PBM_BINPREFIX}pamsumm -brief -max &&
  ${PBM_BINPREFIX}pamsumm -brief -min ${tmpdir}/a3.ppm &&
rm ${tmpdir}/a3.ppm