Divide-and-Conquer: Generating UI Code from Screenshots
Top Cited Papers
Open Access
- 19 June 2025
- journal article
- Published by Association for Computing Machinery (ACM) in Proceedings of the ACM on Software Engineering
- Vol. 2 (FSE) , 2099-2122
Abstract
Websites are critical in today’s digital world, with over 1.11 billion currently active and approximately 252,000 new sites launched daily. Converting website layout design into functional UI code is a time-consuming yet indispensable step of website development. Manual methods of converting visual designs into functional code present significant challenges, especially for non-experts. To explore automatic design-to-code solutions, we first conduct a motivating study on GPT-4o and identify three types of issues in generating UI code: element omission, element distortion, and element misarrangement. We further reveal that a focus on smaller visual segments can help multimodal large language models (MLLMs) mitigate these failures in the generation process. In this paper, we propose DCGen, a divide-and-conquer-based approach to automate the translation of webpage design to UI code. DCGen starts by dividing screenshots into manageable segments, generating code for each segment, and then reassembling them into complete UI code for the entire screenshot. We conduct extensive testing with a dataset comprised of real-world websites and various MLLMs and demonstrate that DCGen achieves up to a 15% improvement in visual similarity and 8% in code similarity for large input images. Human evaluations show that DCGen can help developers implement webpages significantly faster and more similar to the UI designs. To the best of our knowledge, DCGen is the first segment-aware MLLM-based approach for generating UI code directly from screenshots.Keywords
All Related Versions
Funding Information
- Research Grants Council, University Grants Committee (SRFS2425-4S03)
- Ministry of Education - Singapore (Academic Research Fund (AcRF) Tier 1 grant)
This publication has 31 references indexed in Scilit:
- Prompting Is All You Need: Automated Android Bug Replay with Large Language Models2024
- Semantic Compression with Large Language Models2023
- Web pages from mockup design based on convolutional neural network and class activation mappingMultimedia Tools and Applications, 2023
- Code generation from a graphical user interface via attention-based encoder–decoder modelMultimedia Systems, 2021
- Image Segmentation Using Deep Learning: A SurveyIEEE Transactions on Pattern Analysis and Machine Intelligence, 2021
- Deep learning‐based prototyping of android GUI from hand‐drawn mockupsIET Software, 2020
- Software engineering process models for mobile app development: A systematic literature reviewJournal of Systems and Software, 2018
- pix2code2018
- Machine Learning-Based Prototyping of Graphical User Interfaces for Mobile AppsIEEE Transactions on Software Engineering, 2018
- Evaluating Direct Manipulation Operations for Constraint-Based Layout2013