惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

量子位
WordPress大学
WordPress大学
小众软件
小众软件
云风的 BLOG
云风的 BLOG
IT之家
IT之家
人人都是产品经理
人人都是产品经理
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Last Week in AI
Last Week in AI
博客园 - 【当耐特】
T
Tailwind CSS Blog
阮一峰的网络日志
阮一峰的网络日志
V
V2EX
宝玉的分享
宝玉的分享
博客园 - Franky
F
Fortinet All Blogs
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
GbyAI
GbyAI
Hugging Face - Blog
Hugging Face - Blog
Jina AI
Jina AI
D
Docker
博客园 - 聂微东
C
Check Point Blog
H
Help Net Security

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Pet Imagination by Inithouse: our AI pet portrait pipelin...
Jakub · 2026-06-27 · via DEV Community

Jakub

At Inithouse, a studio shipping a growing portfolio of products in parallel, we build tools that do one thing and do it fast. Pet Imagination generates AI portraits of pets in 9 art styles. Upload a photo, pick a style, get your portrait. No signup, no waiting around. The whole thing runs under 60 seconds.

This post breaks down how the pipeline works: the prompt skeleton, the style matrix, and the tricks we use to keep latency low.

The pipeline

The flow has four stages:

Upload and preprocessing. The user uploads a pet photo. We validate the image (format, size, aspect ratio), compress it if needed, and extract the key visual features. The preprocessing step also detects whether the subject is a dog, cat, or another animal. This matters because prompts need to reference the animal type explicitly for consistent output.

Prompt construction. This is where the style matrix kicks in. We build a prompt from a skeleton template and inject style-specific parameters. More on this below.

Generation. The constructed prompt and the preprocessed image hit the image generation API. We measured average response times across hundreds of generations: most styles return in 15 to 35 seconds depending on complexity.

Delivery. The generated portrait gets served to the user. We delete the original upload after processing. No photos stored on our servers, no accounts to worry about.

The prompt skeleton

Every generation starts from the same base structure:

[STYLE_PREFIX]
A portrait of a [ANIMAL_TYPE] in [STYLE_DESCRIPTION].
The subject should be the focal point, [COMPOSITION_RULES].
[QUALITY_MODIFIERS]
[NEGATIVE_CONSTRAINTS]

The skeleton stays constant. What changes per style are five parameter slots:

  • STYLE_PREFIX: sets the overall artistic direction (oil painting, anime cell shading, pencil sketch)
  • STYLE_DESCRIPTION: detailed style instructions (brushstroke texture, color palette, line weight)
  • COMPOSITION_RULES: framing and layout rules specific to the style
  • QUALITY_MODIFIERS: resolution and detail level
  • NEGATIVE_CONSTRAINTS: what to avoid (distortion, extra limbs, text artifacts)

By keeping the skeleton fixed and parameterizing only the style layer, we get predictable quality across all 9 styles without maintaining 9 separate prompt chains.

The style matrix

Each of the 9 styles maps to a distinct set of parameters:

Style Prefix direction Key visual trait Avg. generation time
Renaissance Classical oil painting Rich textures, dramatic lighting ~30s
Watercolor Loose watercolor wash Soft edges, transparent layers ~25s
Anime Cell-shaded illustration Clean lines, large expressive eyes ~20s
Sketch Graphite pencil drawing Cross-hatching, paper texture ~18s
Sheriff Western portrait Sepia tones, badge and hat ~28s
Wizard Fantasy illustration Robes, magical particles ~32s
Astronaut Sci-fi portrait Space suit, starfield background ~30s
Final Boss Video game boss art Dramatic pose, energy aura ~35s
Blocky Voxel/pixel art Cubic geometry, limited palette ~22s

The fun styles (Sheriff, Wizard, Astronaut, Final Boss) need more detailed negative constraints to avoid generic fantasy clip art. We found that adding specific composition rules for these styles ("the pet's face must remain recognizable as the original") reduced uncanny output by roughly 40%.

Latency tricks

Getting the full pipeline under 60 seconds took some iteration. Here is what moved the needle:

Parallel preprocessing. Image validation and animal detection run concurrently, not sequentially. This shaved about 3 seconds off the preprocessing stage.

Prompt caching. The style parameters rarely change. We precompute and cache the full prompt template for each style. At generation time, we only inject the animal type and any image-specific adjustments. Template assembly takes under 50ms instead of building from scratch each time.

Compression before upload. We resize and compress on the client side before sending to the server. Smaller payload means faster upload, and the generation API handles compressed input fine. We measured no visible quality difference in outputs when compressing input images to 70% quality JPEG.

Timeout and retry strategy. If generation exceeds 45 seconds, we cancel and retry once with a slightly simplified prompt (fewer quality modifiers). About 8% of generations hit the timeout on first attempt; the simplified retry succeeds in under 30 seconds almost every time.

What we learned across the portfolio

Building image generation at Pet Imagination taught us patterns we applied elsewhere. At Ziva Fotka, our tool that turns still photos into short animated videos, we reused the same parallel preprocessing approach. The latency savings compound when you process thousands of images daily.

We also found that exposing the generation pipeline openly (showing progress stages to the user instead of a blank loading screen) reduced perceived wait time. Users who see "preprocessing your photo" followed by "generating portrait" report the process feeling faster than users who just see a spinner. We observed the same pattern across multiple products in the portfolio.

Wrapping up

The full prompt skeleton and style matrix are what make Pet Imagination consistent at speed. Nine styles, one pipeline, no accounts, photos deleted after processing. If you want to try it: petimagination.com.

We keep shipping tools like this at Inithouse, a studio running parallel product experiments. Pet portraits today, animated photos tomorrow. Each product in the portfolio teaches us something about the next one.