I'm trying to create around 900 small files from a list of hex codes. I have a YAML file (hexcode.yml) and am using the following code:
Code: Select all
#!/usr/bin/ruby
require "yaml"
YAML.load_file("hexcode.yml").each do |name, color|
p "Creating: #{name} (#{color}) => images/colors/#{name}.png"
%x[ convert -size 2x2 xc:white -draw "fill white rectangle 0,0 2,2" -draw "fill #{color} rectangle 0,0 2,2" "images/colors/#{name}.png" ]
end
"Creating: 000000 '#000000' 000080 '#000080' 00008B '#00008B' 00009C '#00009C' 0000CD '#0000CD' 0000EE '#0000EE' 0000FF '#0000FF', etc..."
and errors with:
Code: Select all
convert: unrecognized color `rectangle' @ warning/color.c/GetColorCompliance/947.
convert: non-conforming drawing primitive definition `fill' @ error/draw.c/DrawImage/3164.
Any help would be appreciated.