Permalink
Browse files

Merge pull request #111 from yabawock/master

Add auto_orient command to ImageMagick::Processor
  • Loading branch information...
2 parents 9e97042 + d143391 commit f3aa509cc47820344c1b891639ac861a196d44ff Mark Evans committed Dec 22, 2011
@@ -27,6 +27,10 @@ def resize(temp_object, geometry)
convert(temp_object, "-resize #{geometry}")
end
+ def auto_orient(temp_object)
+ convert(temp_object, "-auto-orient")
+ end
+
def crop(temp_object, opts={})
width = opts[:width]
height = opts[:height]
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -237,6 +237,17 @@
end
end
+ describe "auto-orient" do
+ it "should rotate an image according to exif information" do
+ @image = Dragonfly::TempObject.new(SAMPLES_DIR.join('beach.jpg'))
+ @image.should have_width(355)
+ @image.should have_height(280)
+ image = @processor.auto_orient(@image)
+ image.should have_width(280)
+ image.should have_height(355)
+ end
+ end
+
describe "flip" do
it "should flip the image, leaving the same dimensions" do
image = @processor.flip(@image)

0 comments on commit f3aa509

Please sign in to comment.