Class: ImageVise::Geom

Inherits:
Struct
  • Object
show all
Defined in:
lib/image_vise/operators/geom.rb

Overview

Applies a transformation using an ImageMagick geometry string

The corresponding Pipeline method is ‘geom`.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGeom

Returns a new instance of Geom.

Raises:

  • (ArgumentError)


5
6
7
8
9
# File 'lib/image_vise/operators/geom.rb', line 5

def initialize(*)
  super
  self.geometry_string = geometry_string.to_s
  raise ArgumentError, "the :geom parameter must be present and not empty" if self.geometry_string.empty?
end

Instance Attribute Details

#geometry_stringObject

Returns the value of attribute geometry_string

Returns:

  • (Object)

    the current value of geometry_string



4
5
6
# File 'lib/image_vise/operators/geom.rb', line 4

def geometry_string
  @geometry_string
end

Instance Method Details

#apply!(image) ⇒ Object



11
12
13
# File 'lib/image_vise/operators/geom.rb', line 11

def apply!(image)
  image.change_geometry(geometry_string) { |cols, rows, _| image.resize!(cols,rows) }
end