From d09ef138cbe0223a188c6880fc4c8a0559a5cfe6 Mon Sep 17 00:00:00 2001 From: rdrew Date: Thu, 5 Feb 2026 11:37:00 -0400 Subject: [PATCH] [nb] Edit: cli_commands.md --- cli_commands.md | 47 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/cli_commands.md b/cli_commands.md index 78169e2..ea89792 100644 --- a/cli_commands.md +++ b/cli_commands.md @@ -33,11 +33,46 @@ gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 \ (batch) -for f in *.PDF; do - gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 \ +# In the folder with your PDFs +mkdir downsampled + +for f in *.pdf *.PDF; do + [ -f "$f" ] || continue + gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen \ -dNOPAUSE -dBATCH \ - -dDownsampleColorImages=true -dColorImageResolution=72 \ - -dDownsampleGrayImages=true -dGrayImageResolution=72 \ - -dDownsampleMonoImages=true -dMonoImageResolution=72 \ - -sOutputFile="output_pdfs/$f" "$f" + -sOutputFile="downsampled/${f%.pdf}_72dpi.pdf" \ + "$f" +done +# In the folder that contains your original PDFs + +mkdir -p downsampled + +for f in *.pdf *.PDF; do + [ -f "$f" ] || continue + gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen \ + -dNOPAUSE -dBATCH -dQUIET \ + -sOutputFile="downsampled/$f" \ + "$f" +done + +# check current dpi +for f in *.pdf *.PDF; do + echo "=== Images in: $f ===" + pdfimages -list "$f" + echo "" +done +# Creates (or overwrites) images_list.txt in the current directory +for f in *.pdf *.PDF; do + if [ -f "$f" ]; then + echo "=== Images in: $f ===" >> images_list.txt + pdfimages -list "$f" >> images_list.txt + echo "" >> images_list.txt + fi +done +# scan for ccitt encoding +for f in *.pdf *.PDF; do + [ -f "$f" ] || continue + if pdfimages -list "$f" 2>/dev/null | grep -q " ccitt "; then + echo "$f uses CCITT" + fi done