Projects

Image to Code AI — Transform UI Designs into Clean HTML Code

image
November 26, 2025
"Why spend hours coding when AI can do it in seconds?"
Hey there, it's Bima again! This time, I want to share something I've been working on: Image to Code AI — a smart tool that transforms any UI design image into clean, responsive HTML code using the power of artificial intelligence.
It's an AI-powered web application that converts visual UI designs into functional HTML code instantly. No more manually coding every button, header, and layout from scratch. Just upload your design image, and let AI do the heavy lifting.
As a developer, I noticed how time-consuming it is to convert design mockups into actual code. So I built this tool to:
  • Save development time - From hours to minutes
  • Bridge design and development - Seamless transition from visual to code
  • Explore AI capabilities - Using Google's Gemini AI for accurate conversion
  • Support multiple frameworks - Tailwind, Bootstrap, Materialize, and more
  • Make coding more accessible - Even non-developers can get started quickly

  • AI-Powered Conversion - Uses Google Gemini AI for accurate UI analysis
  • Multiple CSS Frameworks - Choose from Tailwind, Bootstrap, Materialize, Bulma, or Vanilla CSS
  • Responsive Design - Mobile-first, responsive HTML output
  • Clean Code Generation - Well-structured, readable HTML with inline CSS
  • Easy Download - Get your HTML file with one click
  • User-Friendly Interface - Simple Streamlit-based web app

  1. Upload your UI design image (PNG, JPG, JPEG)
  2. Select your preferred CSS framework
  3. Click "Code UI" and watch AI analyze your design
  4. Download the generated HTML file
  5. Use the code in your project!
The AI performs multiple analysis steps:
  • Describes UI elements with precise bounding boxes
  • Refines the analysis for accuracy
  • Generates initial HTML structure
  • Refines the code for better responsiveness and design matching

  • Rapid Prototyping - Convert sketches to functional layouts
  • Design to Code Workflow - Streamline handoff process
  • Learning Tool - Understand how designs translate to code
  • Start Point - Get base code and customize from there
  • Time-Saving - Focus on functionality instead of basic layout

Since this is a Streamlit application, you can run it locally:
# Install dependencies
pip install -r requirements.txt

# Run the app
streamlit run main.py
Just open your browser, upload a design image, and let AI work its magic!
  • Streamlit - Web application framework
  • Google Gemini AI - Advanced language model for image analysis and code generation
  • PIL (Pillow) - Image processing capabilities
  • Python - Core programming language

The app uses a sophisticated two-step AI process:
  1. Image Analysis - Gemini AI analyzes UI elements, colors, and layout
  2. Code Generation - Creates responsive HTML with your chosen framework
It also handles various image formats and ensures the generated code matches the original design as closely as possible.
Got ideas? Found bugs? Want to collaborate? Hit me up: Let's keep building useful tools that make development faster and more accessible! 🚀
This project showcases how AI can streamline the design-to-code workflow, making development more efficient for everyone.