Class: ShatteredMachine::Transpose

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

Overview

Use the transpose algorithm from pnglitch on a given png image.

Constant Summary collapse

ALL_FILTERS =
%w[none sub up average paeth].freeze

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Transpose



10
11
12
13
# File 'lib/shattered_machine/transpose.rb', line 10

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

Instance Method Details

#call(input_image, output_image) ⇒ boolean



18
19
20
21
22
23
# File 'lib/shattered_machine/transpose.rb', line 18

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