This paper proposes a new automatic image enhancement method via improving the image dynamic range. The improvement is performed via modifying the Gamma value of pixels in the image. Gamma distortion in an image is due to the technical limitations in the imaging device, and imposes a nonlinear effect. The severity of distortion in an image varies depending on the texture and depth of the objects. The proposed method locally estimates the Gamma values in an image. In this method, the image is initially segmented using a pixon-based approach. All of the pixels in each segment have similar characteristics in terms of the need for Gamma correction. Then, the Gamma value for each segment is estimated by minimizing the homogeneity of co-occurrence matrix. This feature can represent image details. The minimum value of this feature in a segment shows maximum details of the segment. The quality of an image is improved once more details are presented in the image via Gamma correction. In this study, it is shown that the proposed method performs well in improving the quality of images. Subjective and objective image quality assessments performed in this study attest the superiority of the proposed method compared to the existing methods in image quality enhancement.