Exploiting the utility of near-term quantum devices is a long-standing challenge whereas hybrid quantum machine learning emerges as a promising candidate. Here we propose a quantum-enhanced deep generative algorithm based on programmable quantum circuit-induced quantum latent codes. To validate the effectiveness of the algorithm, we conduct optical ghost imaging experiments, collecting dataset under varying physical sampling rates. Leveraging a physically enhanced loss function and a pretrained neural network, the quantum algorithm exhibits superior reconstruction performance compared to conventional algorithms. We observe the learnable quantum latent space enhances the out-of-distribution generalization capability of the pretrained model. In the context of computer vision problems, numerical results indicate that quantum latent space can increase the generation diversity of the pretrained model. Furthermore, the algorithm outperforms classical counterparts, particularly in image inpainting and colorization, by a significant margin. Our study demonstrates the utility of hybrid quantum-classical algorithms in enhancing generalization capability, highlighting the potential of near-term quantum devices in large-scale generative artificial intelligence.