Created
June 15, 2015 08:31
-
-
Save golive/d3871398004e70699fa2 to your computer and use it in GitHub Desktop.
Generate all colors of RGB in a png file
This file contains 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 'chunky_png' | |
png = ChunkyPNG::Image.new(4096, 4096) | |
(0..255).each do |b| | |
(0..255).each do |g| | |
(0..255).each do |r| | |
x = b/16*256 + r | |
y = b%16*256 + g | |
png[x,y] = ChunkyPNG::Color.rgb(r, g, b) | |
end | |
end | |
end | |
png.save('color_palette.png') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment