class ImageVise::Crop
Crops the image to the given dimensions with a given gravity. Gravities are shorthand versions of ImageMagick gravity parameters (see GRAVITY_PARAMS
)
The corresponding Pipeline method is `crop`.
Constants
- GRAVITY_PARAMS
Public Class Methods
new(*)
click to toggle source
Calls superclass method
# File lib/image_vise/operators/crop.rb, line 18 def initialize(*) super self.width = width.to_i self.height = height.to_i raise ArgumentError, ":width must positive" unless width > 0 raise ArgumentError, ":height must positive" unless height > 0 raise ArgumentError, ":gravity must be within the permitted values" unless GRAVITY_PARAMS.key? gravity end
Public Instance Methods
apply!(image)
click to toggle source
# File lib/image_vise/operators/crop.rb, line 27 def apply!(image) image.crop!(GRAVITY_PARAMS.fetch(gravity), width, height, remove_padding_data_outside_window = true) end