Class: ShatteredMachine::Defect
- Inherits:
-
Object
- Object
- ShatteredMachine::Defect
- Defined in:
- lib/shattered_machine/defect.rb
Overview
Use the defect algorithm from pnglitch on a given png image.
Instance Method Summary collapse
-
#call(input_image, output_image) ⇒ boolean
Status of defect.
-
#initialize(options = {}) ⇒ Defect
constructor
A new instance of Defect.
Constructor Details
#initialize(options = {}) ⇒ Defect
Returns a new instance of Defect.
8 9 10 11 |
# File 'lib/shattered_machine/defect.rb', line 8 def initialize( = {}) @random = [:random] || false @iterations = [:iterations] || 1 end |
Instance Method Details
#call(input_image, output_image) ⇒ boolean
Returns status of defect.
16 17 18 19 20 21 |
# File 'lib/shattered_machine/defect.rb', line 16 def call(input_image, output_image) PNGlitch.open(input_image) do |png| filtered_glitch(png).save output_image end output_image end |