Advertisement
walsch

Untitled

Feb 6th, 2025
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.83 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Ordner mit Bildern (hier aktuelles Verzeichnis)
  4. BILDER_ORDNER="./"
  5.  
  6. # Bildformate anpassen, falls nötig
  7. BILDFORMATE=("*.jpg" "*.jpeg" "*.png")
  8.  
  9. # Über alle Bildformate iterieren
  10. for format in "${BILDFORMATE[@]}"; do
  11.     for bild in "$BILDER_ORDNER"/$format; do
  12.         # Prüfen, ob Datei existiert (falls kein Match)
  13.         [ -e "$bild" ] || continue
  14.  
  15.         # Bildgröße auslesen (Breite x Höhe)
  16.         read width height <<< $(identify -format "%w %h" "$bild")
  17.  
  18.         # Prüfen, ob Breite größer als Höhe ist
  19.         if [ "$width" -gt "$height" ]; then
  20.             echo "Drehe $bild (Breite: $width, Höhe: $height) um 270°..."
  21.             mogrify -rotate 270 "$bild"
  22.         else
  23.             echo "Überspringe $bild (Breite: $width, Höhe: $height)"
  24.         fi
  25.     done
  26. done
  27.  
  28. echo "Fertig!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement