On 26/08/05, Joe Van Dyk <joevandyk / gmail.com> wrote:
> 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?
> 
> 

Use Magick::MaxRGB+1 instead of 256. RGB Values range from 0...2**16.
And be shure to check out the View funktionality.

regards,

Brian

-- 
http://ruby.brian-schroeder.de/

Stringed instrument chords: http://chordlist.brian-schroeder.de/