Class: Blobsterix::Transformations::Impl::CropImage

Inherits:
Transformation show all
Defined in:
lib/blobsterix/transformation/image_transformation.rb

Instance Method Summary collapse

Methods inherited from Transformation

#is_format?, #to_s

Methods included from Logable

#logger, #logger=

Instance Method Details

#input_typeObject



146
147
148
# File 'lib/blobsterix/transformation/image_transformation.rb', line 146

def input_type()
  @input_type ||= Blobsterix::AcceptType.new "image/*"
end

#nameObject



143
144
145
# File 'lib/blobsterix/transformation/image_transformation.rb', line 143

def name()
  "crop"
end

#output_typeObject



150
151
152
# File 'lib/blobsterix/transformation/image_transformation.rb', line 150

def output_type()
  @output_type ||= Blobsterix::AcceptType.new "image/*"
end

#transform(input_path, target_path, value) ⇒ Object



154
155
156
157
158
# File 'lib/blobsterix/transformation/image_transformation.rb', line 154

def transform(input_path, target_path, value)
  image = MiniMagick::Image.open(input_path)
  image.crop value
  image.write target_path
end