with: result = Array.new(orig_width * orig_height) and if "preallocate" was the wrong word, I apologise!