API
Text2Card API
通过 API 生成精美文字卡片。简单的 REST API,无需认证。
极速响应
边缘计算,全球加速
5 种主题
所有主题均可通过 API 使用
高清输出
1080p+ PNG 图片
多语言
支持中英文文本
快速开始
使用简单的 GET 请求生成文字卡片:
GET https://your-domain.com/api/generate?text=Hello%20World&theme=minimal效果预览:
参数说明
| 参数 | 类型 | 说明 | 默认值 |
|---|---|---|---|
text* | string | 要显示的文字内容 | - |
author | string | 底部显示的作者名 | @text2card_design |
theme | string | minimal | editorial | bold | dark | gradient | minimal |
ratio | string | square | portrait | landscape | portrait |
可用主题
minimaleditorialbolddarkgradient宽高比
square1080×1080px
portrait1080×1440px
landscape1440×1080px
代码示例
cURL
curl -o card.png "https://your-domain.com/api/generate?text=Design%20is%20intelligence%20made%20visible.&theme=minimal&ratio=portrait"HTML
<img src="https://your-domain.com/api/generate?text=Your%20Quote%20Here&theme=bold&ratio=square" alt="Text Card" />JavaScript
// Fetch and display the image
const text = encodeURIComponent("Design is intelligence made visible.");
const imageUrl = `https://your-domain.com/api/generate?text=${text}&theme=gradient&ratio=portrait`;
// Use in an img tag or download
const img = document.createElement('img');
img.src = imageUrl;
document.body.appendChild(img);POST Request
对于较长文本或需要更多控制时,使用 POST 请求发送 JSON:
// POST request for longer text
const response = await fetch('https://your-domain.com/api/generate', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
text: "This is a longer piece of text that you might want to send via POST instead of GET.",
author: "@yourname",
theme: "editorial",
ratio: "portrait"
})
});
const blob = await response.blob();
const imageUrl = URL.createObjectURL(blob);使用限制
API 免费使用,有合理的使用限制:
- • 无需认证
- • 适当的速率限制
- • 允许商业使用
准备好了吗?
立即开始将 Text2Card 集成到你的项目中。
试用编辑器