Class: ShatteredMachine::ChangeByte

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

Overview

Use the change byte algorithm from pnglitch on a given png image.

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ ChangeByte

Returns a new instance of ChangeByte.

Parameters:

  • options (Hash) (defaults to: {})

    options for change byte algorithm



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

def initialize(options = {})
  @byte_numbers = options[:byte_numbers].to_i || 0
end

Instance Method Details

#call(input_image, output_image) ⇒ boolean

Returns status of change byte.

Parameters:

  • input_image (string)

    path for image

  • output_image (string)

    path for output changed byte image

Returns:

  • (boolean)

    status of change byte



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

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