30 lines
683 B
Text
30 lines
683 B
Text
|
|
#!/bin/bash
|
||
|
|
# h2j — HEIC zu JPG konvertieren
|
||
|
|
# Usage: h2j [-r] [-d] [-rd]
|
||
|
|
# -r Resize auf max. 1920px
|
||
|
|
# -d HEIC-Originale löschen
|
||
|
|
# -rd Beides
|
||
|
|
|
||
|
|
RESIZE=false
|
||
|
|
DELETE=false
|
||
|
|
|
||
|
|
for arg in "$@"; do
|
||
|
|
case "$arg" in
|
||
|
|
-r) RESIZE=true ;;
|
||
|
|
-d) DELETE=true ;;
|
||
|
|
-rd|-dr) RESIZE=true; DELETE=true ;;
|
||
|
|
esac
|
||
|
|
done
|
||
|
|
|
||
|
|
count=0
|
||
|
|
for file in *.{heic,HEIC}; do
|
||
|
|
[[ -f "$file" ]] || continue
|
||
|
|
output="${file%.*}.jpg"
|
||
|
|
heif-convert -q 90 "$file" "$output" || continue
|
||
|
|
((count++))
|
||
|
|
[[ "$RESIZE" == true ]] && [[ -f "$output" ]] && mogrify -resize 1920x1920\> "$output"
|
||
|
|
[[ "$DELETE" == true ]] && rm "$file"
|
||
|
|
done
|
||
|
|
|
||
|
|
echo "$count Bild(er) konvertiert."
|