Text Portrait 文字肖像生成器
Text Portrait 是一个创意图像工具,上传照片后移除背景,并用文学文本填充人物轮廓,生成由文字构成的肖像。
What it is / 项目是什么
Upload a photo, AI removes the background, and fills your silhouette with literary text. Shakespeare, Dickens, Laozi — your portrait in words.
上传照片,AI 去除背景,用文学作品填充你的轮廓。莎士比亚、狄更斯、老子——用文字构成你的肖像。
How it works / 实现原理
前端使用 MediaPipe 的人像分割模型把照片里的人和背景分开,得到 alpha 通道掩膜。然后选一段文本(默认提供莎士比亚、狄更斯、老子等公共版权作品,也可粘贴自己的文字),在掩膜区域内用 canvas 排版渲染。字号、密度、颜色、行距都可以调,文字会沿着轮廓填满整个剪影。最终导出 PNG 或 SVG。
Who it is for / 适合谁
想把头像、照片和文学文本结合成视觉作品的创作者。
Typical use cases / 常见使用场景
- 生成有文字感的社交头像和封面图
- 为活动海报、书籍宣传图做视觉素材
- 把自己写的诗或散文做成文字肖像送朋友
Key features / 主要功能
- 上传照片后自动处理人物轮廓
- 使用文学文本填充剪影,形成文字肖像
- 适合生成头像、海报和社交媒体视觉素材
Design notes / 设计取舍
这类工具如果做成简单 demo,效果会很"AI 风"。Text Portrait 花了不少精力调字号自适应和边缘处理:当人脸细节比较多时,自动加大字号以避免文字糊成一团;轮廓边缘做轻微羽化,让文字像水墨晕开而不是硬切。这些细节决定了它能不能被当成可用作品而不是玩具。
Technology stack / 技术栈
Each layer below was chosen for what it lets the project avoid as much as what it enables. Together they shape the latency, the build pipeline, and how quickly new ideas can be tried in production.
下面这些选择,更多是为了排除某些复杂度,而不只是为了“用上”。它们共同决定了项目的延迟特性、构建流水线,以及把一个想法跑通的最短路径。
Vite
A fast frontend build tool with native ESM dev server. Hot-reload is near-instant even on large component trees.
TypeScript
A typed superset of JavaScript that catches mismatches at compile time. Helps keep the codebase maintainable as projects grow.
MediaPipe
Google's on-device perception toolkit. Used here for real-time face landmark detection in the browser.
FAQ / 常见问题
上传的照片会被保存吗?
不会。分割和渲染都在浏览器中完成,照片不上传服务器。
可以用自己的文本吗?
可以。文本输入框接受任意长度的字符,包括中文、英文及标点。建议长度足够覆盖整个轮廓。
为什么我的输出文字看起来很挤?
通常是文本太短或字号太大。可以增加文本长度,或调小字号;也可以打开"自动重复填充"选项。
商用可以吗?
工具本身免费,输出可商用。请确保你用的文本和照片拥有相应授权。
More projects from jiligulu
If this project struck a chord, the same hands are behind these. Each one was built to answer a different question — and each one borrows lessons from the rest.
JSON Tools
The fast, private JSON toolkit developers actually use — formatter, validator, viewer, and converters. Everything runs in your browser; nothing leaves your device.
Read morePersonality testSBTI
A provocative personality test that roasts you. 31 questions, 15 dimensions, 29 personality types — each one brutally honest. 100K+ tests taken.
Read morePersonality test hub人格实验室
A dedicated personality-test hub with 16 playful tests, from MBTI-inspired formats to relationship, work, values, and social-persona quizzes.
Read moreContinue reading
The blog goes deeper into the ideas behind Text Portrait. These pieces unpack the psychology, the engineering trade-offs, and the design questions this project raises.
- 11 min read
拖延不是懒,是情绪调节问题 / Procrastination Isn't Laziness, It's Emotion Regulation
你拖延某件事的真正原因,几乎从来不是"我懒",而是"做这件事会让我感觉不好"。Pychyl 和 Sirois 这两位拖延心理学家的研究把这事讲得很硬,也带来一组完全不一样的应对方法。/ The real reason you procrastinate on something almost never reduces to "I'm lazy." It's "doing this would make me feel bad." Tim Pychyl and Fuschia Sirois have spent decades demonstrating this — and the implications change what a useful response looks like.
- 10 min read
独处不等于孤独 / Solitude Is Not the Same as Loneliness
中文里"独处"和"孤独"经常被混着用,神经科学和心理学却把它们当成两件几乎相反的事——前者是恢复,后者是消耗。这篇讲一下两者的差别、独处的具体好处,以及为什么现代生活把独处变得越来越难。/ Chinese readers often blur "solitude" and "loneliness"; neuroscience and psychology treat them as nearly opposite phenomena — one restores, the other drains. This piece spells out the difference, what solitude actually does, and why modern life makes it so hard to access.
- 9 min read
你在 GitHub、LinkedIn、Twitter 上是同一个人吗?/ Are You the Same Person on GitHub, LinkedIn, and Twitter?
程序员、设计师、做产品的人——基本上每个互联网工作者,都在三五个平台上有不同程度割裂的"自己"。这种割裂是策略上的成熟,还是身份层面的代价?/ Engineers, designers, product folks — basically everyone who works online maintains some level of fractured self across three or five platforms. Is that fracture strategic maturity, or an identity-level cost?