blob: f030b746e640d930f8c49f36d819a6579b674522 [file] [log] [blame]
oscarbeneditoef77d902019-09-30 19:44:52 +02001#!/bin/bash
Ernesto Lanchares74b0d872019-09-30 15:47:51 +02002
3# Usage: script pdf1 pdf2
4
5convert -density 96 $1 -colorspace RGB a.png
Ernesto Lancharesb2c20be2019-10-01 11:46:40 +02006echo "Finished conversion of $1"
Ernesto Lanchares74b0d872019-09-30 15:47:51 +02007convert -density 96 $2 -colorspace RGB b.png
Ernesto Lancharesb2c20be2019-10-01 11:46:40 +02008echo "Finished conversion of $2"
Ernesto Lanchares74b0d872019-09-30 15:47:51 +02009
10# For output files
11for i in b-*.png; do
12 out=$(magick compare -metric PSNR ${i} a${i:1} diff.png 2>&1)
Ernesto Lancharesb2c20be2019-10-01 11:46:40 +020013 #echo "checking page ${i:2:${#i}-6}"
14 if [[ "$out" != "inf" ]] && [[ $out < 45 ]]; then
Ernesto Lanchares74b0d872019-09-30 15:47:51 +020015 echo "Error, difference in page ${i:2:${#i}-6} diff.png"
Ernesto Lancharesb2c20be2019-10-01 11:46:40 +020016 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 Lanchares74b0d872019-09-30 15:47:51 +020024 fi
25done
26
27rm -rf b-*.png a-*.png