Advertisement
Sepheus

ExtractSOS

Nov 24th, 2012
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.49 KB | None | 0 0
  1. require 'chunky_png'
  2. require 'Base64'
  3.  
  4. image = ChunkyPNG::Image.from_file('SOS.png')
  5.  
  6. image.rotate_180!
  7.  
  8. alph = image.to_alpha_channel_stream
  9. red = image.to_rgb_stream.unpack('axx'*(image.to_rgb_stream.length/3)).join
  10. green = image.to_rgb_stream.unpack('xax'*(image.to_rgb_stream.length/3)).join
  11. blue = image.to_rgb_stream.unpack('xxa'*(image.to_rgb_stream.length/3)).join
  12.  
  13. IO.binwrite("Alpha.raw",alph)
  14. IO.binwrite("Red.raw",red)
  15. IO.binwrite("Green.raw",green)
  16. IO.binwrite("Blue.raw",blue)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement