oscarbenedito | ef77d90 | 2019-09-30 19:44:52 +0200 | [diff] [blame] | 1 | #!/bin/bash |
Ernesto Lanchares | 74b0d87 | 2019-09-30 15:47:51 +0200 | [diff] [blame] | 2 | |
| 3 | # Usage: script pdf1 pdf2 |
| 4 | |
| 5 | convert -density 96 $1 -colorspace RGB a.png |
Ernesto Lanchares | b2c20be | 2019-10-01 11:46:40 +0200 | [diff] [blame] | 6 | echo "Finished conversion of $1" |
Ernesto Lanchares | 74b0d87 | 2019-09-30 15:47:51 +0200 | [diff] [blame] | 7 | convert -density 96 $2 -colorspace RGB b.png |
Ernesto Lanchares | b2c20be | 2019-10-01 11:46:40 +0200 | [diff] [blame] | 8 | echo "Finished conversion of $2" |
Ernesto Lanchares | 74b0d87 | 2019-09-30 15:47:51 +0200 | [diff] [blame] | 9 | |
| 10 | # For output files |
| 11 | for i in b-*.png; do |
| 12 | out=$(magick compare -metric PSNR ${i} a${i:1} diff.png 2>&1) |
Ernesto Lanchares | b2c20be | 2019-10-01 11:46:40 +0200 | [diff] [blame] | 13 | #echo "checking page ${i:2:${#i}-6}" |
| 14 | if [[ "$out" != "inf" ]] && [[ $out < 45 ]]; then |
Ernesto Lanchares | 74b0d87 | 2019-09-30 15:47:51 +0200 | [diff] [blame] | 15 | echo "Error, difference in page ${i:2:${#i}-6} diff.png" |
Ernesto Lanchares | b2c20be | 2019-10-01 11:46:40 +0200 | [diff] [blame] | 16 | while true; do |
| 17 | read -p "Do you wish to ignore this and continue?" yn |
| 18 | case $yn in |
| 19 | [Yy]* ) break;; |
| 20 | [Nn]* ) break 3;; |
| 21 | * ) echo "Please answer yes or no.";; |
| 22 | esac |
| 23 | done |
Ernesto Lanchares | 74b0d87 | 2019-09-30 15:47:51 +0200 | [diff] [blame] | 24 | fi |
| 25 | done |
| 26 | |
| 27 | rm -rf b-*.png a-*.png |