Class: ShatteredMachine::WrongFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/shattered_machine/wrong_filter.rb

Overview

Use the wrong filter algorithm from pnglitch on a given png image.

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ WrongFilter



8
9
10
# File 'lib/shattered_machine/wrong_filter.rb', line 8

def initialize(options = {})
  @filter = options[:filter] || 'average'
end

Instance Method Details

#call(input_image, output_image) ⇒ boolean



15
16
17
18
19
20
# File 'lib/shattered_machine/wrong_filter.rb', line 15

def call(input_image, output_image)
  PNGlitch.open(input_image) do |png|
    filtered_glitch(png, @filter).save output_image
  end
  output_image
end