From e5b5ca1f1628248349ef81a46abdf48be2a3330c Mon Sep 17 00:00:00 2001 From: Hendrik Jäger Date: Wed, 22 Feb 2023 11:37:18 +0100 Subject: fix: stick to namespace --- .zsh_functions/henks_pwgen | 2 ++ .zsh_functions/henks_scan_postproc | 30 ++++++++++++++++++++++++++++++ .zsh_functions/henkspngpostproc | 30 ------------------------------ .zsh_functions/henkspwgen | 2 -- 4 files changed, 32 insertions(+), 32 deletions(-) create mode 100644 .zsh_functions/henks_pwgen create mode 100644 .zsh_functions/henks_scan_postproc delete mode 100644 .zsh_functions/henkspngpostproc delete mode 100644 .zsh_functions/henkspwgen diff --git a/.zsh_functions/henks_pwgen b/.zsh_functions/henks_pwgen new file mode 100644 index 0000000..0f6d80c --- /dev/null +++ b/.zsh_functions/henks_pwgen @@ -0,0 +1,2 @@ +PROMPT_EOL_MARK= +(tr -cd '[:alnum:]' | head -c $1) < /dev/urandom diff --git a/.zsh_functions/henks_scan_postproc b/.zsh_functions/henks_scan_postproc new file mode 100644 index 0000000..e721f4c --- /dev/null +++ b/.zsh_functions/henks_scan_postproc @@ -0,0 +1,30 @@ +setopt PIPE_FAIL + +local resize_by +local img +resize_by="$1" +shift +for img in $* +do + echo "Processing ${img} ..." + # mostly to remove the alpha channel so ocrmypdf can work with it + # does not seem to work all the time, so 'convert' is used as well below + # still nice to optimize + optipng "${img}" + if [ $? -ne 0 ] + then + echo "optipng failed" + return + fi + # resize + # and remove alpha channel so ocrmypdf can work with it + # ocrmypdf does the quantization of the png which reduces size drastically + convert -resize $resize_by% -alpha off "$img" - \ + | ocrmypdf - "$(basename $img .png).pdf" + if [ $? -ne 0 ] + then + echo "convert or ocrmypdf failed" + return + fi +done + diff --git a/.zsh_functions/henkspngpostproc b/.zsh_functions/henkspngpostproc deleted file mode 100644 index e721f4c..0000000 --- a/.zsh_functions/henkspngpostproc +++ /dev/null @@ -1,30 +0,0 @@ -setopt PIPE_FAIL - -local resize_by -local img -resize_by="$1" -shift -for img in $* -do - echo "Processing ${img} ..." - # mostly to remove the alpha channel so ocrmypdf can work with it - # does not seem to work all the time, so 'convert' is used as well below - # still nice to optimize - optipng "${img}" - if [ $? -ne 0 ] - then - echo "optipng failed" - return - fi - # resize - # and remove alpha channel so ocrmypdf can work with it - # ocrmypdf does the quantization of the png which reduces size drastically - convert -resize $resize_by% -alpha off "$img" - \ - | ocrmypdf - "$(basename $img .png).pdf" - if [ $? -ne 0 ] - then - echo "convert or ocrmypdf failed" - return - fi -done - diff --git a/.zsh_functions/henkspwgen b/.zsh_functions/henkspwgen deleted file mode 100644 index 0f6d80c..0000000 --- a/.zsh_functions/henkspwgen +++ /dev/null @@ -1,2 +0,0 @@ -PROMPT_EOL_MARK= -(tr -cd '[:alnum:]' | head -c $1) < /dev/urandom -- cgit v1.2.3