working on Publications

This commit is contained in:
2025-08-29 20:19:21 +02:00
parent 181e5a0097
commit 029cc0a7ef
420 changed files with 85885 additions and 52 deletions

View File

@@ -0,0 +1,70 @@
#!/bin/bash
# --- Configuration ---
# DPI for the output image. Higher DPI means higher resolution and larger file size.
# Common values: 72, 96, 150, 300
OUTPUT_DPI=150
# PNG quality (0-100). 90 is a good balance.
PNG_QUALITY=90
# --- Script Logic ---
# Check if magick command is available
if ! command -v magick &> /dev/null
then
echo "Error: 'magick' command not found. Please install ImageMagick."
echo "On Arch Linux, you can install it with: sudo pacman -S imagemagick"
exit 1
fi
# Check if any PDF files were provided as arguments
if [ "$#" -eq 0 ]; then
echo "Usage: $0 <pdf_file1.pdf> [<pdf_file2.pdf> ...]"
echo "Converts the first page of each PDF to a PNG image using ImageMagick's 'magick' command."
exit 1
fi
echo "Starting PDF to PNG conversion using 'magick'..."
echo "Output DPI: $OUTPUT_DPI, PNG Quality: $PNG_QUALITY"
# Loop through all PDF files provided as arguments
for pdf_file in "$@"; do
# Basic validation
if [ ! -f "$pdf_file" ]; then
echo "Error: File not found: $pdf_file. Skipping."
continue
fi
if [[ "$pdf_file" != *.pdf ]]; then
echo "Warning: '$pdf_file' does not appear to be a PDF file. Skipping."
continue
fi
echo "Processing: $pdf_file"
# Get the base filename without the extension
base_name=$(basename "$pdf_file" .pdf)
# Define the output PNG file name
output_png="${base_name}.png"
# Use magick to convert the first page ([0]) of the PDF to PNG
# -density: Sets the resolution (DPI)
# -quality: Sets the compression quality for PNG
# "$pdf_file[0]": Specifies the input PDF file and the first page (index 0)
# "$output_png": The desired output PNG file name
magick -density "$OUTPUT_DPI" -quality "$PNG_QUALITY" "$pdf_file[0]" "$output_png"
# Check the exit status of the magick command
if [ $? -eq 0 ]; then
echo " -> Created: $output_png"
else
echo " -> Error: Failed to create PNG for $pdf_file."
# You could add more specific error handling here if needed,
# e.g., trying to use a different density or quality.
fi
done
echo "Conversion finished."
exit 0

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB