In a high-brightness photocathode gun, the non-uniformity in both the transverse distribution of the photocathode drive laser and the quantum efficiency (QE) map can lead to degradation in electron beam quality. This study explores an adaptive transverse laser shaping technique and its application to improve the uniformity of the electrons emitted from the photocathode. Utilizing a spatial light modulator (SLM) with a feedback algorithm, we effectively control the drive laser distribution and achieve single-shot QE map measurement and QE compensation. The experiments conducted on the DC-SRF-II gun demonstrate a rapid and efficient QE measurement process, as well as a notable improvement in electron beam uniformity. Our study offers a promising approach for improving beam quality in accelerator applications that demand high-brightness electron sources.