--- /dev/null
+PROMPT_EOL_MARK=
+(tr -cd '[:alnum:]' | head -c $1) < /dev/urandom
--- /dev/null
+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
+
+++ /dev/null
-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
-
+++ /dev/null
-PROMPT_EOL_MARK=
-(tr -cd '[:alnum:]' | head -c $1) < /dev/urandom