linux: automatisches rotieren von photos

    Die Anmeldung zum Wiener Fotomarathon am 14.09.2025 ist online Infos & Anmeldung

    Gewinne Einkaufs-Gutscheine beim Fotowettbewerb "Wiener Traditionen" Jetzt mitmachen

    • linux: automatisches rotieren von photos

      hi,

      ich hab eine kleines script geschrieben das n photos basierend auf der exifinformation dreht.
      und dann die exif information updated.
      für linux.
      sicherlich gibts sowas in form eines GUIs aber mir ist die shell schon immer lieber gewesen.

      funktionieren tut es so:
      ./rotatepic.pl <dateiliste>
      beispiel:
      cd /home/tom/meinebilder/
      /bin/rotatepic.pl *.jpg

      dachte mir ich post das hier.......vielleicht kann es irgendjemand brauchen. ansonsten einfach ingorieren :)

      Perl-Quellcode

      1. #!/usr/bin/perl
      2. #Thomas Anglmaier 2007
      3. #rotatepic.pl v0.2
      4. #quick and dirty - no warranty - use on your own risk!
      5. #automatic rotate script for Nikons D70(s) camera
      6. #(probably also working with other makes)
      7. #this script needs exiftool and imagemagick installed
      8. #tested on debian lenny/sid
      9. #Under the terms of GPLv2.
      10. $cw = "90";
      11. $ccw = "-90";
      12. @files = @ARGV;
      13. foreach (@files) {
      14. $orientation = `exiftool $_ | grep Orientation`;
      15. next if $orientation =~ /Horizontal \(normal\)/;
      16. system("convert -rotate $ccw $_ $_") if $orientation =~ /Rotate 270 CW/ && print "$_ rotated 90° CCW | ";
      17. system("convert -rotate $cw $_ $_") if $orientation =~ /Rotate 90 CW/ && print "$_ rotated 90° CW | ";
      18. system("exiftool -overwrite_original -Orientation=\"Horizontal (normal)\" $_ > /dev/null");
      19. print "EXIF Information updated\n" if $? == 0;
      Alles anzeigen


      lg
      thomas

      BTW: für anregungen, fragen und kritik bin ich immer offen.

      Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von tamash ()

    Registrieren oder Anmelden

    Du musst auf fotografie.at angemeldet sein, um hier antworten zu können.

    Registrieren

    Hier kannst Du Dich neu registrieren - einfach und schnell!


    Neu registrieren

    Annmelden

    Du bist schon Mitglied? Hier kannst Du Dich anmelden.


    Anmelden