|
Packit |
78deda |
#! /bin/bash
|
|
Packit |
78deda |
# This script tests: g3topbm pbmtog3
|
|
Packit |
78deda |
# Also requires: pnmcrop
|
|
Packit |
78deda |
|
|
Packit |
78deda |
tmpdir=${tmpdir:-/tmp}
|
|
Packit |
78deda |
complete256_pbm=${tmpdir}/complete256.pbm
|
|
Packit |
78deda |
widew_pbm=${tmpdir}/widew.pbm
|
|
Packit |
78deda |
wideb_pbm=${tmpdir}/wideb.pbm
|
|
Packit |
78deda |
|
|
Packit |
78deda |
pbmtog3 -nofixedwidth testgrid.pbm | \
|
|
Packit |
78deda |
g3topbm -width=14 | cmp -s - testgrid.pbm
|
|
Packit |
78deda |
echo $?
|
|
Packit |
78deda |
|
|
Packit |
78deda |
pbmtog3 -nofixedwidth -reversebits testgrid.pbm | \
|
|
Packit |
78deda |
g3topbm -width=14 -reversebits | cmp -s - testgrid.pbm
|
|
Packit |
78deda |
echo $?
|
|
Packit |
78deda |
|
|
Packit |
78deda |
pbmtog3 testgrid.pbm | \
|
|
Packit |
78deda |
g3topbm | pnmcrop -white -right -bottom | \
|
|
Packit |
78deda |
cmp -s - testgrid.pbm ; echo $?
|
|
Packit |
78deda |
|
|
Packit |
78deda |
# works with gawk and mawk
|
|
Packit |
78deda |
# produce all possible 8-bit patterns
|
|
Packit |
78deda |
|
|
Packit |
78deda |
LC_ALL=C awk 'BEGIN { print "P4"; # header
|
|
Packit |
78deda |
print "8 256";
|
|
Packit |
78deda |
for (i=0;i<256;++i) # raster
|
|
Packit |
78deda |
printf("%c",i) }' > ${complete256_pbm}
|
|
Packit |
78deda |
|
|
Packit |
78deda |
pbmtog3 -nofixedwidth ${complete256_pbm} | g3topbm -width=8 | \
|
|
Packit |
78deda |
cmp -s - ${complete256_pbm} ; echo $?
|
|
Packit |
78deda |
|
|
Packit |
78deda |
pbmtog3 -reverse -nofixedwidth ${complete256_pbm} | \
|
|
Packit |
78deda |
g3topbm -reversebits -width=8 | \
|
|
Packit |
78deda |
cmp -s - ${complete256_pbm} ; echo $?
|
|
Packit |
78deda |
|
|
Packit |
78deda |
pbmtog3 -align8 ${complete256_pbm} | \
|
|
Packit |
78deda |
g3topbm -width=1728 | pnmcrop -white -right | \
|
|
Packit |
78deda |
cmp -s - ${complete256_pbm} ; echo $?
|
|
Packit |
78deda |
|
|
Packit |
78deda |
pbmtog3 -align16 ${complete256_pbm} | \
|
|
Packit |
78deda |
g3topbm -width=1728 | pnmcrop -white -right | \
|
|
Packit |
78deda |
cmp -s - ${complete256_pbm} ; echo $?
|
|
Packit |
78deda |
|
|
Packit |
78deda |
pbmmake -w 5000 5 > ${widew_pbm}
|
|
Packit |
78deda |
pbmtog3 -nofixedwidth ${widew_pbm} | g3topbm | \
|
|
Packit |
78deda |
cmp -s - ${widew_pbm} ; echo $?
|
|
Packit |
78deda |
|
|
Packit |
78deda |
pbmtog3 -nofixedwidth ${widew_pbm} | \
|
|
Packit |
78deda |
g3topbm -width=5000 | \
|
|
Packit |
78deda |
cmp -s - ${widew_pbm} ; echo $?
|
|
Packit |
78deda |
|
|
Packit |
78deda |
pbmmake -b 5000 5 > ${wideb_pbm}
|
|
Packit |
78deda |
pbmtog3 -nofixedwidth ${wideb_pbm} | g3topbm | \
|
|
Packit |
78deda |
cmp -s - ${wideb_pbm} ; echo $?
|
|
Packit |
78deda |
|
|
Packit |
78deda |
cat ${complete256_pbm} | cksum
|
|
Packit |
78deda |
cat ${wideb_pbm} | cksum
|
|
Packit |
78deda |
cat ${widew_pbm} | cksum
|
|
Packit |
78deda |
|
|
Packit |
78deda |
rm ${complete256_pbm} ${wideb_pbm} ${widew_pbm}
|