One-dimensional detrended fluctuation analysis (1D DFA) and multifractal detrended fluctuation analysis (1D MF-DFA) are widely used in the scaling analysis of fractal and multifractal time series because of being accurate and easy to implement. In this paper we generalize the one-dimensional DFA and MF-DFA to form high-dimensional versions. The generalization works well when tested with synthetic surfaces (fractional Brownian surfaces and multifractal surfaces). The two-dimensional MF-DFA is also adopted to analyze two images from nature and experiment and nice scaling laws are unraveled.