about summary refs log tree commit diff
path: root/test/bmp-quant-roundtrip.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/bmp-quant-roundtrip.test')
-rwxr-xr-xtest/bmp-quant-roundtrip.test36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/bmp-quant-roundtrip.test b/test/bmp-quant-roundtrip.test
new file mode 100755
index 00000000..2c223b7c
--- /dev/null
+++ b/test/bmp-quant-roundtrip.test
@@ -0,0 +1,36 @@
+#! /bin/bash
+# This script tests: bmptopnm ppmtobmp pnmquant
+# Also requires: ppmhist
+
+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}