module AttachmentSaver::Processors::ImageScience::Operations

Public Instance Methods

crop_to(new_width, new_height, &block) click to toggle source
# File lib/processors/image_science.rb, line 82
def crop_to(new_width, new_height, &block) # crops to the center
  left = (width - new_width)/2
  right = (height - new_height)/2
  with_crop(left, right, left + new_width, right + new_height) do |image|
    image.extend Operations
    block.call(image) # as for resize, with_crop doesn't take a block itself
  end
end
file_type_extension() click to toggle source
# File lib/processors/image_science.rb, line 71
def file_type_extension
  file_type.downcase
end
resize_to(new_width, new_height, &block) click to toggle source
# File lib/processors/image_science.rb, line 75
def resize_to(new_width, new_height, &block)
  resize(new_width, new_height) do |image|
    image.extend Operations
    block.call(image) # ImageScience itself doesn't accept a block argument (it yields only)
  end
end