Skip to content

Instantly share code, notes, and snippets.

@jbrechtel
Created April 22, 2011 00:25
Show Gist options
  • Save jbrechtel/935773 to your computer and use it in GitHub Desktop.
Save jbrechtel/935773 to your computer and use it in GitHub Desktop.
rgb_values = "ffaaffaabbccdd3322fa352fda2"
decimal_values = []
rgb_values.each_slice(2) do |pair|
decimal_values << pair.join("").hex
end
File.open('test.jpg', 'wb') do |file|
file.print(decimal_values.pack("c*"))
end
rgb_values = "ffaaffaabbccdd3322fa352fda2"
decimal_values = []
rgb_values.each_slice(2) do |pair|
decimal_values << pair.join("").hex
end
File.open('test.jpg', 'wb') do |file|
file.print(decimal_values.pack("c*"))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment