Skip to main content

Purpose

Generates a hand-sketched artistic version of a website’s favicon using OpenAI’s gpt-image-1.5 model. Used on the marketing website for visual appeal.

Architecture

Pipeline

  1. Fetch Favicon - Try HTML parsing, common paths, then Google fallback
  2. Convert to PNG - Handle ICO, SVG, JPEG, GIF formats
  3. Check Generic - Skip if Google returns generic globe icon
  4. Generate Enhanced - Send to OpenAI with style reference image
  5. Return Base64 - Return as data URL for immediate display

Internal Services

ServicePurpose
fetch_faviconDownloads favicon from website
convert_to_pngConverts any image format to PNG
generate_enhanced_logoCalls OpenAI gpt-image-1.5
get_base_image_bytesLoads style reference image

Code Location

src/website/enhanced_logo/
β”œβ”€β”€ routes.py       # HTTP endpoint
β”œβ”€β”€ service.py      # All business logic
└── base_image.png  # Style reference (hand-sketched Target logo)

Rate Limiting

  • 10 requests per minute per IP address

OpenAI Model

Uses gpt-image-1.5 with images.edit endpoint for style transfer.