Module: PNG::Encode::InstanceMethods

Defined in:
lib/png-encode/encode.rb

Instance Method Summary collapse

Instance Method Details

#encode(outfile) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/png-encode/encode.rb', line 16

def encode(outfile)
  png = ChunkyPNG::Image.new(1, @data.size, ChunkyPNG::Color::TRANSPARENT)

  i = 0
  @data.each_byte do |b|
    png[0, i] = b
    i += 1
  end

  png.save outfile
end