move move old scripts
This commit is contained in:
1 parent
93b262977b
commit
208fbd96b4
27 files changed
+346
No files matched your search
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Convert the first page of a PDF to a JPEG image.
|
||||
# Usage: ./pdf_to_jpg.sh <file.pdf>
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [[ $# -ne 1 ]]; then
|
||||
echo "Usage: $0 <file.pdf>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
INPUT_PDF="$1"
|
||||
|
||||
if [[ ! -f "$INPUT_PDF" ]]; then
|
||||
echo "Error: '$INPUT_PDF' not found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Remove .pdf extension and prepend IMG_
|
||||
BASE_NAME="$(basename "$INPUT_PDF" .pdf)"
|
||||
OUTPUT_JPG="IMG_${BASE_NAME}.jpg"
|
||||
|
||||
echo "Converting first page of '$INPUT_PDF' to '$OUTPUT_JPG'..."
|
||||
|
||||
pdftoppm -f 1 -l 1 "$INPUT_PDF" | pnmtojpeg > "$OUTPUT_JPG"
|
||||
|
||||
echo "Done: $OUTPUT_JPG created."
|
||||
Reference in new issue
Block a user