How Sketch2Code Turns Hand‑Drawn UI Designs into Ready‑to‑Use HTML with AI

Sketch2Code leverages Microsoft’s custom vision model, OCR, and Azure services to automatically convert hand‑drawn UI mockups into functional HTML code, detailing its workflow—from image upload and element prediction to layout generation and final HTML output—plus links to the repository and demo site.

JavaScript
JavaScript
JavaScript
How Sketch2Code Turns Hand‑Drawn UI Designs into Ready‑to‑Use HTML with AI

Sketch2Code is an AI‑powered solution that converts hand‑drawn user interface designs from images into valid HTML markup code, as demonstrated below:

Sketch2Code demo
Sketch2Code demo

Sketch2Code Workflow

User uploads an image of the hand‑drawn design to the website.

A custom vision model predicts the HTML elements present in the image and marks their locations.

An OCR service reads any text within the predicted elements.

A layout algorithm generates a grid structure based on the bounding‑box information of the elements.

The HTML generation engine uses this information to produce the final HTML code.

Sketch2Code Solution

Microsoft Custom Vision Model: pre‑trained on various hand‑drawn designs to label common HTML elements such as buttons, text boxes, and images.

Microsoft Computer Vision Service: used to recognize text inside the design elements.

Azure Blob Storage: stores all intermediate data during HTML generation, including the original image, prediction results, and layout information.

Azure Functions: serves as the backend entry point, coordinating the generation process by interacting with other services.

Azure Web Site: the front‑end where users upload new design images and view the generated HTML.

These components form the following architecture:

Sketch2Code architecture
Sketch2Code architecture
Repository address: https://github.com/Microsoft/ailab/tree/master/Sketch2Code Website address: https://sketch2code.azurewebsites.net
Additional illustration
Additional illustration
computer visionAIUI designAzureHTML generation
JavaScript
Written by

JavaScript

Provides JavaScript enthusiasts with tutorials and experience sharing on web front‑end technologies, including JavaScript, Node.js, Deno, Vue.js, React, Angular, HTML5, CSS3, and more.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.