-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbatch-djxl
More file actions
executable file
·35 lines (27 loc) · 1.08 KB
/
batch-djxl
File metadata and controls
executable file
·35 lines (27 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
# Define the file extensions to search for
EXTENSIONS=(jxl)
DJXL_OPTIONS=""
echo "Starting JXL to JPEG conversion..."
# Loop through all defined extensions
for ext in "${EXTENSIONS[@]}"; do
# Find files with the current extension
for file in *."${ext}"; do
# Check if the file exists (handles the case where no files match the glob)
if [[ -f "${file}" ]]; then
# Construct the output filename (.jxl)
output_file="${file%.*}.jpg"
echo "Converting ${file} to ${output_file}..."
# Run the cjxl command
# The '$CJXL_OPTIONS' variable is used for any desired settings
if djxl "${file}" "${output_file}" $DJXL_OPTIONS; then
# If conversion is successful, remove the original file
echo "Conversion successful. Removing original ${file}."
rm "${file}"
else
echo "ERROR: djxl failed for ${file}. Keeping original file."
fi
fi
done
done
echo "Conversion complete."