Class: Blobsterix::Transformations::Impl::ColorSpaceImage

Inherits:
Transformation
  • Object
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



6
7
8
# File 'lib/blobsterix/transformation/image_transformation.rb', line 6

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

#nameObject



3
4
5
# File 'lib/blobsterix/transformation/image_transformation.rb', line 3

def name()
  "grayscale"
end

#output_typeObject



10
11
12
# File 'lib/blobsterix/transformation/image_transformation.rb', line 10

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

#transform(input_path, target_path, value) ⇒ Object



14
15
16
17
18
# File 'lib/blobsterix/transformation/image_transformation.rb', line 14

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