Fixed potential off-by-one error in ImageBuffer_get_histogram()