lib/dragonfly/processing/r_magick_processor.rb in dragonfly-0.1.0 vs lib/dragonfly/processing/r_magick_processor.rb in dragonfly-0.1.1
- old
+ new
@@ -48,9 +48,23 @@
gravity = GRAVITY_MAPPINGS[opts[:gravity]] || Magick::CenterGravity
image.resize_to_fill(width, height, gravity).to_blob
end
+ def rotate(temp_object, opts={})
+ if opts[:amount]
+ args = [opts[:amount].to_f]
+ args << opts[:qualifier] if opts[:qualifier]
+ image = rmagick_image(temp_object)
+ image.background_color = opts[:background_colour] if opts[:background_colour]
+ image.background_color = opts[:background_color] if opts[:background_color]
+ rotated_image = image.rotate(*args)
+ rotated_image ? rotated_image.to_blob : temp_object
+ else
+ temp_object
+ end
+ end
+
def vignette(temp_object, opts={})
x = opts[:x].to_f || temp_object.width * 0.1
y = opts[:y].to_f || temp_object.height * 0.1
radius = opts[:radius].to_f || 0.0
sigma = opts[:sigma].to_f || 10.0