Adds postscan

This commit is contained in:
Thomas Forgione 2024-09-27 15:32:59 +02:00
parent 9de770c4bc
commit 110164b71e
1 changed files with 9 additions and 0 deletions

9
bin/post-scan Executable file
View File

@ -0,0 +1,9 @@
#!/usr/bin/env bash
# auto fix issues with my scanner
input="$3"
color=$(magick "$input" -format "%[hex:u.p{100,-1}]" info:)
tmp=$(mktemp --suffix=.png)
magick "$input" -page +0-100 -background \#$color -flatten -auto-level $tmp
magick $tmp -quality 100 "${input%.*}.pdf"
rm -rf $tmp "$input"