435 shaares
38 private links
38 private links
#!/bin/bash
# Set the input and output directories
input_dir="./Photos"
output_dir="./Photos-jpg-300"
# Check if the output directory exists; if not, create it
if [ ! -d "$output_dir" ]; then
mkdir -p "$output_dir"
fi
# Loop through all PDF files in the input directory
for pdf_file in "$input_dir"/*.pdf; do
if [ -f "$pdf_file" ]; then
# Get the base filename without the extension
base_name=$(basename "$pdf_file" .pdf)
# Convert the PDF file to JPG format
convert -density 300 "$pdf_file" "$output_dir/${base_name}.jpg"
echo "Converted $pdf_file to ${base_name}.jpg"
fi
done
echo "Conversion completed."