lib/image_voodoo.rb in image_voodoo-0.9.2 vs lib/image_voodoo.rb in image_voodoo-0.9.3
- old
+ new
@@ -92,9 +92,15 @@
def correct_orientation
target = guard { correct_orientation_impl }
block_given? ? yield(target) : target
end
+ # crops part of an image
+ def crop(x, y, width, height)
+ target = with_crop(x, y, x + width, y + height)
+ block_given? ? yield(target) : target
+ end
+
# Creates a square thumbnail of the image cropping the longest edge to
# match the shortest edge, resizes to size, and yields/returns the new image.
def cropped_thumbnail(size)
l, t, r, b = calculate_thumbnail_dimensions
target = with_crop(l, t, r, b).thumbnail(size)