Created
April 22, 2015 13:31
-
-
Save leeky/6cd3f3692c365865d35d to your computer and use it in GitHub Desktop.
Convert PNG to base64 encoded string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'base64' | |
File.open('./outfile.txt','w') {|f| f.write "data:image/png;base64," + Base64.strict_encode64(File.read('./input.png'))} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment