Aiming at the problems of low brightness and blurred details in images captured under low light, an image enhancement algorithm based on gradient sparsity and multi-scale variational constraint was proposed by analyzing the defects of traditional Retinex theory. Firstly, the input image was transformed from RGB space to HSV space, and the luminance component was extracted to decouple three channels. Then, according to the gradient global significance of zero norm, a new relative total variation regular term was defined. After that, the luminance component was punished in HSV space, and a variational model with gradient sparsity was constructed to constrain the brightness channel. By expanding the control factors to multiple scales, a multi-scale variational constraint was formed, which improves the accuracy of illumination estimation and makes it more in line with the illumination distribution characteristics. According to the Retinex theory, areflection map corresponding to brightness channel was obtained. Then, the rough details, medium details and fine details of the image were extracted by using different illumination results corresponding to constraints in different scales of brightness channel, and the details of the reflection map was enhanced by multi-scale detail weighting. Finally, the illumination map after Gamma correction was recombined with the enhanced reflection ma, and the color space conversion was carried out to obtain the output enhanced image. Experimental comparisons show that the enhanced images of the proposed algorithm visually have richer colors richness and lower color difference level, and keep the naturalness well. Compared with the original images, the performance of mean value, average gradient and information entropy have been greatly improved. Compared with the existing advanced algorithms, the average quantitative index of the proposed algorithm achieves a better effect on the enhanced images of different types of low-light images with higher computational efficiency.