There is a method called each_pixel on your image object. I think that might be what you want. Latest version of RMagick and some of the older versions also has it
(Object) each_pixel
def each_pixel
get_pixels(0, 0, columns, rows).each_with_index do |p, n|
yield(p, n%columns, n/columns)
end
self
end
You can find the documentation and other methods here