Add h2j: kompakter HEIC-zu-JPG-Befehl mit Flags (-r, -d, -rd)
Ersetzt die vier einzelnen Skripte durch ein einziges mit Flags. Alte Skripte bleiben für Abwärtskompatibilität erhalten. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
b841b396c6
commit
5de7cf2c94
1 changed files with 29 additions and 0 deletions
29
heic-scripts/h2j
Executable file
29
heic-scripts/h2j
Executable file
|
|
@ -0,0 +1,29 @@
|
||||||
|
#!/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."
|
||||||
Loading…
Add table
Add a link
Reference in a new issue