I'm trying to set the pixels of an image:

require 'RMagick'

width = 512
height = 256

image = Magick::Image.new width, height

width.times do |x|
  height.times do |y|
    pixel = Magick::Pixel.new rand(256), rand(256), rand(256)
    image.pixel_color x, y, pixel 
  end
end

image.write ARGV.shift

But the resulting image is all black.  Why?