Skip to content

Instantly share code, notes, and snippets.

@helloitszak
Created May 5, 2014 21:00
Show Gist options
  • Save helloitszak/ebac0ceca4ee42eabf09 to your computer and use it in GitHub Desktop.
Save helloitszak/ebac0ceca4ee42eabf09 to your computer and use it in GitHub Desktop.
Extract Emoji from G+ Hangouts Sprite Sheet
#!/usr/bin/env ruby
require 'free-image'
require 'ruby-progressbar'
image = FreeImage::Bitmap.open(ARGV[0])
count = (image.height + 1) / 29
pb = ProgressBar.create(:title => "Scaling", :total => count)
count.times do |i|
#puts i
top = i * 29
bottom = top + 28
image.copy(0,top,28,bottom) do |face|
# :box is for shitty scaling
face.rescale(500,500,:bicubic).save("bicubic/#{i}.png", :png)
pb.increment
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment