diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index bb7a86d..7345d15 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,5 +8,87 @@
exif-image-rotation-tool
1.0-SNAPSHOT
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.7.0
+
+ 1.8
+ 1.8
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+
+
+ copy-dependencies
+ prepare-package
+
+ copy-dependencies
+
+
+ ${project.build.directory}/lib
+ false
+ false
+ true
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+
+ true
+ lib/
+ org.lalber.tools.exifrotation.Main
+
+
+
+
+
+ maven-assembly-plugin
+
+
+
+ org.lalber.tools.exifrotation.Main
+
+
+
+ jar-with-dependencies
+
+
+
+
+ make-assembly
+ package
+
+ single
+
+
+
+
+
+
+
+
+
+ javaxt.com
+ http://www.javaxt.com/maven
+
+
+
+
+
+ javaxt
+ javaxt-core
+ 1.9.0
+
+
\ No newline at end of file
diff --git a/src/main/java/org/lalber/tools/exifrotation/Main.java b/src/main/java/org/lalber/tools/exifrotation/Main.java
new file mode 100644
index 0000000..22238c6
--- /dev/null
+++ b/src/main/java/org/lalber/tools/exifrotation/Main.java
@@ -0,0 +1,83 @@
+package org.lalber.tools.exifrotation;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import javax.swing.*;
+import javax.swing.border.EtchedBorder;
+import javax.swing.border.TitledBorder;
+import javaxt.io.Image;
+
+/**
+ * @author Lucas Alber
+ */
+public class Main {
+
+ /**
+ * Main entry point to application.
+ *
+ * @param args not used.
+ */
+ public static void main(String[] args) {
+ File folder = showFileSelectionDialog();
+ if (folder == null) return;
+
+ JPanel mainPanel = new JPanel();
+ mainPanel.setBorder(new TitledBorder(new EtchedBorder(), "Process:"));
+
+ JTextArea textArea = new JTextArea(16, 58);
+ textArea.setEditable(false);
+ JScrollPane scroll = new JScrollPane(textArea);
+ scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
+
+ mainPanel.add(scroll);
+
+ JFrame frame = new JFrame();
+ frame.setTitle("Exif Image-Rotation Tool");
+ frame.add(mainPanel);
+ frame.pack();
+ frame.setLocationRelativeTo(null);
+ frame.setVisible(true);
+
+ try {
+ Files.walk(folder.toPath())
+ .filter(Main::isImage)
+ .forEach(p -> {
+ textArea.append("Processing: " + p.getFileName().toString() + "\n");
+ Image img = new Image(p.toFile());
+ img.rotate();
+ img.saveAs(p.toFile());
+ });
+
+ } catch (IOException e) {
+ System.err.println("Error processing images!");
+ e.printStackTrace();
+ }
+
+ textArea.append("FINISHED!");
+ }
+
+ /**
+ * Shows a Dialog to choose a Directory.
+ * @return the directory or null if the dialog was closed
+ */
+ private static File showFileSelectionDialog() {
+ JFileChooser fileChooser = new JFileChooser();
+ fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ if (fileChooser.showDialog(null, "OK") != JFileChooser.APPROVE_OPTION)
+ return null;
+ return fileChooser.getSelectedFile();
+ }
+
+ private static boolean isImage(Path p) {
+ try {
+ String content = Files.probeContentType(p);
+ if (content == null) return false;
+ return content.split("/")[0].equals("image");
+ } catch (IOException e) {
+ e.printStackTrace();
+ return false;
+ }
+ }
+}