use identify to discover EXIF orientation rather than exif
authorgc <gc>
Sun, 18 Sep 2005 20:51:27 +0000 (20:51 +0000)
committergc <gc>
Sun, 18 Sep 2005 20:51:27 +0000 (20:51 +0000)
external binary

lib/booh/booh-lib.rb

index fe89dfe..6f87d90 100644 (file)
@@ -206,10 +206,14 @@ module Booh
     end
 
     def guess_rotate(filename)
-        orientation = `exif '#{filename}'`.detect { |line| line =~ /^Orientation/ }
-        if orientation =~ /right - top/
+        if $no_identify
+            return 0
+        end
+
+        orientation = `identify -format "%[EXIF:orientation]" '#{filename}'`.chomp
+        if orientation == '6'
             angle = 90
-        elsif orientation =~ /left - bottom/
+        elsif orientation == '8'
             angle = -90
         else
             return 0