Class: ShatteredMachine::Transpose
- Inherits:
-
Object
- Object
- ShatteredMachine::Transpose
- 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
-
#call(input_image, output_image) ⇒ boolean
Status of transpose.
-
#initialize(options = {}) ⇒ Transpose
constructor
A new instance of Transpose.
Constructor Details
#initialize(options = {}) ⇒ Transpose
Returns a new instance of Transpose.
10 11 12 13 |
# File 'lib/shattered_machine/transpose.rb', line 10 def initialize( = {}) @filter = define_filter([:filter]) || 'average' @transpose_force = [:transpose_force] || 'half' end |
Instance Method Details
#call(input_image, output_image) ⇒ boolean
Returns status of transpose.
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 |