From: ces.fci.junk@... Date: 2005-11-14T15:07:16+09:00 Subject: RMagick 1.9.3: examples/histogram.rb - erro Trying to run the histogram.rb ~/$myimage produces the following error: Creating b194000514_7064_Histogram.miffhistogram.rb:180:in `histogram': undefined method `+' for nil:NilClass (NoMethodError) from histogram.rb:179:in `each' from histogram.rb:179:in `histogram' from histogram.rb:177:in `times' from histogram.rb:177:in `histogram' from histogram.rb:280 For the moment commenting these lines will let it run and output a viewable miff (beginning at line 180): #red[pixel.red] += 1 #green[pixel.green] += 1 #blue[pixel.blue] += 1 # Only count opacity channel if some pixels are not opaque. if !opaque? alpha[pixel.opacity] += 1 end v = pixel_intensity(pixel) #int[v] += 1 Potentially relevent (or not relevent) information: Ruby 1.8.2 ImageMagick 6.1.9 Linux 2.6.10 The other examples appear to run without issue. I am also relatively new to Ruby if that matters. I tried adding these in the appropiate locations (figured it may have had problems adding to nil): red[pixel.red] = 0 if red[pixel.red].nil? blue[pixel.blue] = 0 if blue[pixel.blue].nil? green[pixel.green] = 0 if green[pixel.green].nil? #... alpha[pixel.opacity] = 0 if alpha[pixel.opacity].nil? #... int[v] = 0 if int[v].nil? The result is another error, but I am not sure how to get around it: Creating b194000514_7064_Histogram.miff.histogram.rb:5:in `max': undefined method `<=>' for nil:NilClass (NoMethodError) from histogram.rb:208:in `each' from histogram.rb:208:in `max' from histogram.rb:208:in `histogram' from histogram.rb:292 any thoughts on the matter? Clayton