# File lib/HGR.rb, line 9 def raw_bytes bytes="" bytes<< [137, 80, 78, 71, 13, 10, 26, 10].pack("C*") # PNG signature bytes<< PNG.chunk('IHDR', [ @height, @width, @bits, 6, 0, 0, 0 ].pack("N2C5")) # 0 == filter type code "none" data = @data.map { |row| [0] + row.map { |p| p.values } }.flatten bytes<< PNG.chunk('IDAT', Zlib::Deflate.deflate(data.pack("C*"), 9)) bytes<< PNG.chunk('IEND', '') bytes end