about summary refs log tree commit diff
path: root/test/bmp-quant-roundtrip.test
blob: 9f1036d01b744b786f6d0cf6e732fbbd2b7d9038 (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
34
35
36
#! /bin/bash
# This script tests: bmptopnm ppmtobmp pnmquant
# Also requires:

tmpdir=${tmpdir:-/tmp}
quant_ppm=${tmpdir}/quant.ppm

colors=256      # any value between 2 - 256 works
bpp=8
echo colors=${colors}, bpp=${bpp} 

pnmquant ${colors} testimg.ppm > ${quant_ppm}

for mode in "-windows" "-os2"
  do
  ppmtobmp $mode -bpp=${bpp} ${quant_ppm} | bmptopnm | \
    cmp -s - ${quant_ppm} > /dev/null
  echo ${PIPESTATUS[@]} ":" $?
  done

rm ${quant_ppm}

colors=16      # any value between 2 - 16 works
bpp=4
echo colors=${colors}, bpp=${bpp}

pnmquant ${colors} testimg.ppm > ${quant_ppm}

for mode in "-windows" "-os2"
  do
  ppmtobmp -bpp=${bpp} ${quant_ppm} | bmptopnm | \
    cmp -s - ${quant_ppm} > /dev/null
  echo ${PIPESTATUS[@]} ":" $?
  done

rm ${quant_ppm}