diff --git a/README.md b/README.md index 9032946..f3079c0 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,10 @@ With the verbose option this will also print processing information and the estimated remaining time. +- [`pdfcompress2`](./bin/pdfcompress2) + + Variant of the previous command that uses `poppler` utils and `gs` instead of convert that is old and buggy (this was acually manually modified) + - [`hash2addr`](./bin/hash2addr) Outputs a randomly generated IP address and port number based on the MD5 hash of the input string. diff --git a/bin/pdfcompress b/bin/pdfcompress index 3da3ff5..f8394cc 100755 --- a/bin/pdfcompress +++ b/bin/pdfcompress @@ -76,7 +76,10 @@ start=$(date +%s.%N) for i in $(seq 0 $((page_count-1))); do iter_start=$(date +%s.%N) - convert -density 300 -quality "$quality" "${input_file}[$i]" "$temp_pages_dir/$i.jpg" + # convert -density 300 -quality "$quality" "${input_file}[$i]" "$temp_pages_dir/$i.jpg" + + # Equivalent "gs" command that avoids convert's security policies + gs -sDEVICE=jpeg -o "$temp_pages_dir/$i.jpg" -dFirstPage="$i" -dLastPage="$i" -dJPEGQ="$quality" -r300x300 "$input_file" # Compute estimated remaining time end=$(date +%s.%N) diff --git a/bin/pdfcompress2 b/bin/pdfcompress2 new file mode 100755 index 0000000..fd59b5f --- /dev/null +++ b/bin/pdfcompress2 @@ -0,0 +1,81 @@ +#!/bin/bash + +set -euo pipefail + +help_message="$(cat <