Skip to content

Instantly share code, notes, and snippets.

@AlexKMDev
Created May 28, 2015 10:48
Show Gist options
  • Save AlexKMDev/085eed6dca9a8c55857a to your computer and use it in GitHub Desktop.
Save AlexKMDev/085eed6dca9a8c55857a to your computer and use it in GitHub Desktop.
convert base64-encoded png to binary
require 'base64'
unless ARGV.first.nil?
file = File.new ARGV.first, 'r'
encoded = file.gets
decoded = Base64.decode64 encoded
file.close
output = File.new "#{ARGV.first}.png", 'w'
output.write decoded
output.close
else
print 'no file'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment