• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
paulkinlan

paulkinlan

tracey-mctraceface

Do a drawing and see it with Gemini Flash 2.5 image gen
Public
Like
1
tracey-mctraceface
Home
Code
3
backend
1
frontend
4
README.md
Branches
1
Pull requests
Remixes
History
Environment variables
1
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
8/27/2025
Viewing readonly version of main branch: v11
View latest version
README.md

Trace AI

A creative web application that inverts the concept of tracing. Users draw simple sketches that are transformed by AI into rich, detailed artwork.

Features

  • Responsive Drawing Canvas: Low-latency drawing experience using the Ink API with Pointer Events fallback
  • AI Image Generation: Powered by Google's Gemini 2.5 Flash Image Preview model
  • Modern File Saving: Uses File System Access API with traditional download fallback
  • Accessible Design: Full keyboard navigation and WCAG AA compliance

Project Structure

β”œβ”€β”€ backend/
β”‚   └── index.ts             # Main API endpoint with Gemini integration
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ index.html           # Main HTML template
β”‚   β”œβ”€β”€ app.js              # Main application logic
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ drawing-canvas.js # Drawing canvas Web Component
β”‚   β”‚   └── control-panel.js  # Control panel Web Component
β”‚   └── style.css           # Custom styles
└── README.md

Setup

  1. Set the API Key: Add your Google Gemini API key as an environment variable in Val Town:

    • Go to your Val Town settings
    • Add GEMINI_API_KEY with your Google AI Studio API key
    • Get your API key from: https://aistudio.google.com/app/apikey
  2. Access the Application: The application will be available at the HTTP endpoint URL provided by Val Town

Usage

  1. Draw: Use your mouse, finger, or stylus to draw a simple sketch on the canvas
  2. Generate: Click the "Generate" button to send your sketch to AI
  3. Wait: The AI will transform your sketch into detailed artwork
  4. Save: Download your generated image using the save button

Keyboard Shortcuts

  • Ctrl/Cmd + N: Clear the canvas
  • Ctrl/Cmd + Enter: Generate AI artwork
  • Ctrl/Cmd + S: Save the generated image
  • Delete/Backspace: Clear canvas (when canvas is focused)

Technical Details

  • Frontend: Vanilla JavaScript with Web Components, Tailwind CSS
  • Backend: Deno runtime on Val Town with Hono framework
  • AI Model: Google Gemini 2.5 Flash Image Preview
  • Canvas: HTML5 Canvas with optimized 2D context for low latency
FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
Β© 2026 Val Town, Inc.