最新版本 v2.0

智能占位图
生成解决方案

为设计师和开发者提供完美的占位图生成服务,支持自定义尺寸、颜色、文字内容和字体。

100% 免费使用
无需注册
即时生成

智能占位图生成

快速生成自定义占位图,支持多种格式和尺寸

范围: 10-5000
十六进制
十六进制
支持中文
选择字体
图片预览
生成链接:

常用示例

点击示例代码可直接复制使用

Facebook分享图
https://tu.tuya.ink//1200x630/1877f2/ffffff/Facebook分享图.jpg

推荐尺寸: 1200×630像素

Instagram帖子
https://tu.tuya.ink//1080x1080/f72585/ffffff/Instagram帖子.png

正方形帖子标准尺寸

Twitter卡片
https://tu.tuya.ink//1200x675/1da1f2/ffffff/Twitter卡片.png

推荐尺寸: 1200×675像素

技术文档

探索占位图生成器的完整功能

URL语法规范

基本结构

https://tu.tuya.ink/[width]x[height]/[background]/[color]/[font]/[text].[format]

参数说明

  • 必须 尺寸: 数字x数字 (如 800x600)
  • 可选 背景色: 3/6位十六进制 (如 f0f 或 f0f4f8)
  • 可选 文字颜色: 3/6位十六进制 (如 1e3a8a)
  • 可选 自定义文字: URL编码字符串
  • 可选 字体选择: 字体名称(如 ?font=AnotherFont
  • 必须 格式: png | jpg | gif

示例

基本尺寸

/800x600.png

带背景色

/800x600/f0f4f8.jpg

完整参数

https://tu.tuya.ink/800x600/f0f4f8/1e3a8a/示例图片.png

最佳实践

中文处理

中文需要双重URL编码以确保正确传输:

"测试" → "%25E6%25B5%258B%25E8%25AF%2595"

颜色简写

3位简写会自动扩展为6位完整格式:

"ccc" → "cccccc"

格式选择

  • PNG 支持透明背景,无损质量
  • JPEG 适合照片类图像,有损压缩
  • GIF 支持简单动画,256色限制

响应式设计

使用srcset属性为不同设备提供合适尺寸:

<img srcset="https://tu.tuya.ink/400x300.png 400w, https://tu.tuya.ink/800x600.png 800w" sizes="(max-width: 600px) 400px, 800px">

API集成

HTML直接引用

<img src="https://tu.tuya.ink/800x600/f0f4f8/1e3a8a/示例图片.png" alt="占位图">

JavaScript动态生成

function generatePlaceholder(width, height, text = '') {
  const bgColor = 'f0f4f8';
  const textColor = '1e3a8a';
  const encodedText = encodeURIComponent(encodeURIComponent(text));
  return `https://tu.tuya.ink/${width}x${height}/${bgColor}/${textColor}/${encodedText}.png`;
}

React组件示例

function PlaceholderImage({ width, height, text }) {
  const bgColor = 'f0f4f8';
  const textColor = '1e3a8a';
  const encodedText = encodeURIComponent(encodeURIComponent(text || `${width}x${height}`));
  
  return (
    <img 
      src={`https://tu.tuya.ink/${width}x${height}/${bgColor}/${textColor}/${encodedText}.png`}
      alt={text || '占位图'}
    />
  );
}