about summary refs log tree commit diff
path: root/test/pnmremap2.test
blob: 3399dc39791acc4685887a13bbb39d46650b049a (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
#! /bin/bash
# This script tests: pnmremap
# Also requires: pamdepth pamseq pamtopnm

  alias pnmremap="${PBM_TESTPREFIX}pnmremap"
  alias pamdepth="${PBM_BINPREFIX}pamdepth"
  alias pamseq="${PBM_BINPREFIX}pamseq"
  alias pamtopnm="${PBM_BINPREFIX}pamtopnm"
  shopt -s expand_aliases

pamseq 3 5 -tupletype=RGB | pamtopnm \
 > ${tmpdir}/palette
pamdepth 255 ${tmpdir}/palette > ${tmpdir}/palette255

# Test 2. Default (unmodified quantization)
pnmremap -mapfile=${tmpdir}/palette -nofloyd \
testimg.ppm | cksum

# Test 3. Use first color in palette for missing colors
pnmremap -mapfile=${tmpdir}/palette255 -nofloyd \
 -firstisdefault testimg.ppm | cksum

# Test 4. Use black for missing colors
pnmremap -mapfile=${tmpdir}/palette255 -nofloyd \
-missingcolor=black testimg.ppm | cksum

rm ${tmpdir}/palette{,255}