Backgrounds

This commit is contained in:
2026-03-30 19:40:32 +01:00
parent 1c845777e8
commit b27f3fa744
5 changed files with 54 additions and 33 deletions

View File

@@ -1,29 +0,0 @@
#!/bin/bash
input_dir="$1" # Replace with your input directory path
output_dir="$2" # Replace with your output directory path
# Ensure the output directory exists or create it
mkdir -p "$output_dir"
# Loop through all JPEG files in the input directory
for file in "$input_dir"/*.jpg; do
if [ -e "$file" ]; then
filename=$(basename "$file")
filename_without_extension="${filename%.*}"
output_file1="$output_dir/${filename_without_extension}_left.jpg"
output_file2="$output_dir/${filename_without_extension}_right.jpg"
# Get the width of the image
width=$(identify -format "%w" "$file")
# Use ImageMagick to split the image in half
convert "$file" -crop "50%x100%+0+0" "$output_file1"
convert "$file" -crop "50%x100%+$((width / 2))+0" "$output_file2"
echo "Split $filename into $output_file1 and $output_file2"
fi
done
echo "Splitting completed."