A latent space-based image inpainting approach for the stable diffusion pipeline: enhancing global style consistency
摘要
Generative artificial intelligence has enabled high-quality text-to-image synthesis; however, localized image editing in Stable Diffusion pipelines remains challenging due to semantic inconsistency and unnatural boundary artifacts. In practical scenarios, users often need to modify specific regions of generated images while preserving global stylistic coherence, which is difficult to achieve with conventional mask-based inpainting workflows. To address these limitations, this study proposes a latent-space-driven image inpainting framework that replaces traditional mask inputs with a composite latent tensor encoding both global style information and user-specified local modifications. The proposed approach allows users to intuitively guide edits by pasting reference images onto target regions, providing structured semantic constraints for the diffusion process. This design improves controllability while reducing user effort during interactive editing. Experimental evaluations across multiple visual scenarios demonstrate that the proposed method achieves an average improvement of over 15% in text–image semantic similarity, together with consistent gains in perceptual quality and structural consistency. The results indicate smoother boundary transitions, improved semantic alignment with textual prompts, and better preservation of original image style. Overall, the proposed framework provides a more stable and visually coherent solution for Stable Diffusion-based local inpainting tasks.