Class: Nx::Watermark

Inherits:
Object
  • Object
show all
Defined in:
lib/nx/version.rb,
lib/nx/watermark.rb

Constant Summary collapse

VERSION =
"0.1.1"

Class Method Summary collapse

Class Method Details

.patch(in_options) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/nx/watermark.rb', line 3

def self.patch(in_options)
  source_image = MiniMagick::Image.open(in_options[:source])
  water_image = MiniMagick::Image.new(in_options[:watermark])
  result = source_image.composite(water_image) do |config|
    config.gravity "center"
    config.compose "Over"
    if block_given?
      yield config
    end
  end

  result.write in_options[:dest]
end