Due to the uneven distribution of light at night, the quality of night color image is usually poor, such as low image contrast, low brightness and less texture. Most of existing night color image enhancement algorithms can’t preserve the details and eliminate the “halo effect” at the edge areas of high contrast in the nighttime image processing. To solve these problems, we propose an image enhancement algorithm based on purposeful optimization and improved histogram equalization. The process of the algorithm is conducted in the luminance channel of the HSV color space: 1)enhance the contrast of the source image and reserve details furthest through improving the image gradient values using the method of optimization; 2)enhance the image by the improved histogram equalization which increases the probability of pixel values of small probability; 3)enhance the image brightness through gamma correction. Subjective and objective evaluation shows that our algorithm greatly enhances the image contrast and brightness, recovers the image details, and eliminates the “halo effect” efficiently. Experiments on the different nighttime images demonstrate the effectiveness of our approach. In summary, our algorithm is effective to complete the challenging task of enhancing the nighttime image.