From 110164b71eb1ffd0b9845bfd657ecb1517d1037b Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Fri, 27 Sep 2024 15:32:59 +0200 Subject: [PATCH] Adds postscan --- bin/post-scan | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 bin/post-scan diff --git a/bin/post-scan b/bin/post-scan new file mode 100755 index 0000000..4416f9a --- /dev/null +++ b/bin/post-scan @@ -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"