about summary refs log tree commit diff
path: root/test/ppmmix.test
blob: c3900baf8d3e3bfefb9360401180f6f53787b5b2 (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
29
30
31
32
33
#! /bin/sh
# This script tests: ppmmix
# Also requires: pamdepth pamenlarge pamsumm pbmmake
# Also requires: pgmtopgm pnminvert ppmtopgm


tmpdir=${tmpdir:-/tmp}

# Test 1. Print a pretty checkerboard pattern
a1_pgm=${tmpdir}/a1.pgm
a2_pgm=${tmpdir}/a2.pgm

pbmmake -g 8 8 | pgmtopgm > ${a1_pgm} &&
pbmmake -g 2 2 | pamenlarge 4 | pgmtopgm > ${a2_pgm} &&
ppmmix 0.75 ${a1_pgm} ${a2_pgm} | ppmtopgm | pamdepth 3 -plain &&
rm ${a1_pgm} ${a2_pgm}

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

# Mix image with its own inverse.
# Output should be a monotone gray sheet.
a3_ppm=${tmpdir}/a3.ppm

pnminvert testimg.ppm | ppmmix .5 \
    testimg.ppm - | tee ${a3_ppm} | \
  pamsumm -brief -max &&
  pamsumm -brief -min ${a3_ppm} &&
rm ${a3_ppm}