While various kinds of local tone mapping approaches have been proposed for contrast enhancement, how to automatically recovering overly bright and/or overly dark regions in an image without introducing extra artifacts still remains a challenging problem. Conventional approaches usually apply a translation-invariant filter to decompose the contrast information of an image into a global component and a detailed component and then adjust the contrast components according to some preselected criteria. However, the use of translation-invariant filter makes it hard to adaptively decompose the contrast information based on local image contents. To overcome this problem, we derive a global optimization approach with the use of cell-based matting Laplacian matrix to obtain more accurate decomposition. Besides, for the adjustment of contrast component, we present a spatially varying gamma adjustment approach that can locally recover poorly exposed regions and properly enhance contrast detail. This translation-varying approach can successfully suppress the halo artifacts without the loss of image details.