Skip to content
Snippets Groups Projects
Commit cc51ee36 authored by embie27's avatar embie27
Browse files

feature: -g option for grayscale

parent ec044adc
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,7 @@ usage(){
Falsisign.
Usage:
falsisign -d <input_pdf> -x <X> -y <Y> [-p <pages>] -s <sign_dir> [-S <scale>] [-c] [-i <init_dir> -z <Z> -t <T> [-q <pages>]] [-r <density>] -o <output_pdf>
falsisign -d <input_pdf> -x <X> -y <Y> [-p <pages>] -s <sign_dir> [-S <scale>] [-c] [-i <init_dir> -z <Z> -t <T> [-q <pages>]] [-r <density>] [-g] -o <output_pdf>
Options:
-d <input_pdf> The PDF document you want to sign
......@@ -24,6 +24,7 @@ Options:
Defaults to all but the last
-r <density> Specify the dpi to use in intermediate steps
-a <angle> Specify the rotation (in degrees) to use for all pages
-g Convert to grayscale
-o <output_pdf> The output file name
EOF
exit "$1"
......@@ -31,7 +32,7 @@ EOF
FALSICOORD="$(dirname "${BASH_SOURCE[0]}")/falsicoord.py"
while getopts :hd:x:y:p:s:S:ci:z:t:q:r:a:o: flag
while getopts :hd:x:y:p:s:S:ci:z:t:q:r:a:gi:o: flag
do
case "${flag}" in
d ) DOCUMENT="${OPTARG}";;
......@@ -47,6 +48,7 @@ do
q ) INITIAL_PAGES="${OPTARG}";;
r ) DENSITY="${OPTARG}";;
a ) FIXED_ROTATION="${OPTARG}";;
g ) GRAY=1;;
o ) OUTPUT_FNAME="${OPTARG}";;
h ) usage 0 ;;
* ) usage 1 ;;
......@@ -79,7 +81,12 @@ NUMBER_OF_PAGES=0
for page in "${TMPDIR}/${DOCUMENT_BN}"-*.pdf
do
page_bn=$(basename ${page} .pdf)
if [ -n "${GRAY:-}" ]
then
convert -density "${DENSITY}" "${page}" -resize 2480x3508! -grayscale Rec709Luminance "${TMPDIR}/${page_bn}.png"
else
convert -density "${DENSITY}" "${page}" -resize 2480x3508! "${TMPDIR}/${page_bn}.png"
fi
let NUMBER_OF_PAGES=NUMBER_OF_PAGES+1
done
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment