Skip to content

Instantly share code, notes, and snippets.

@zed-0xff
Last active August 29, 2015 13:57
Show Gist options
  • Save zed-0xff/9439159 to your computer and use it in GitHub Desktop.
Save zed-0xff/9439159 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
#coding: binary
require 'zpng'
require 'sugar_png'
require 'pp'
# !!! convert gif file to png first
# will get 8 frames
images = Dir["task*.png"].sort.map{ |fname| ZPNG::Image.load(fname) }
w = images[0].width
h = images[0].height
sugar = SugarPNG.new :width => w
w.times do |x|
h.times do |y|
a = images.map{ |img| img[x,y] }
if a.uniq.size != 1
sugar[x,y] = :black
end
end
end
sugar.save "sugar.png"
system "zsteg sugar.png"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment