prez-image

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

prez-image — Image tools for presentations

prez-image — 演示文稿图片工具

Get images into prez slides. Three capabilities, one CLI.
为prez幻灯片添加图片。集三大功能于一体的CLI工具。

When to use

使用场景

When building slides with prez and you need:
  • A custom/conceptual image that doesn't exist (illustration, abstract art, scene) ->
    gen
  • A real photograph (people, places, objects, nature) ->
    search
  • A diagram, chart, icon, or graphic you can design as SVG ->
    render
If the user already has images in their repo, just reference them directly — no tool needed.
当你使用prez制作幻灯片,且需要以下类型的图片时:
  • 自定义/概念性图片(不存在于现有素材中,如插画、抽象艺术、场景图)-> 使用
    gen
    命令
  • 真实照片(人物、地点、物品、自然景观)-> 使用
    search
    命令
  • 可设计为SVG的图表、流程图、图标或图形 -> 使用
    render
    命令
如果你的仓库中已有图片,直接引用即可,无需使用本工具。

Commands

命令说明

All commands use
bunx prez-image
from the project root (or
node deck/node_modules/.bin/prez-image
if installed locally).
所有命令需在项目根目录执行
bunx prez-image
(若本地安装则执行
node deck/node_modules/.bin/prez-image
)。

Generate an image with AI

用AI生成图片

bash
bunx prez-image gen "a dark futuristic cityscape, minimal, cinematic" -o deck/public/hero.png
Uses Pollinations.ai (free, no API key required). For higher rate limits, set
POLLINATIONS_API_KEY
.
Options:
  • -o, --output <path>
    — output file (required)
  • -w, --width <px>
    — width, default 1280
  • -h, --height <px>
    — height, default 720
  • --model <name>
    — Pollinations model, default "flux"
  • --seed <n>
    — seed for reproducible output
bash
bunx prez-image gen "a dark futuristic cityscape, minimal, cinematic" -o deck/public/hero.png
基于Pollinations.ai实现(免费使用,无需API密钥)。若需要更高调用限额,可设置
POLLINATIONS_API_KEY
环境变量。
选项:
  • -o, --output <path>
    — 输出文件路径(必填)
  • -w, --width <px>
    — 图片宽度,默认1280像素
  • -h, --height <px>
    — 图片高度,默认720像素
  • --model <name>
    — Pollinations模型,默认使用"flux"
  • --seed <n>
    — 随机种子,用于生成可复现的结果

Search for a photo

搜索照片

bash
bunx prez-image search "team collaboration in modern office" -o deck/public/team.jpg
Searches Unsplash and Pexels for royalty-free, landscape-oriented photos. Requires at least one API key:
Options:
  • -o, --output <path>
    — output file (required)
  • --provider <name>
    — force "unsplash" or "pexels" (default: tries both)
bash
bunx prez-image search "team collaboration in modern office" -o deck/public/team.jpg
在Unsplash和Pexels中搜索免版权的横版照片。需至少配置一个API密钥:
选项:
  • -o, --output <path>
    — 输出文件路径(必填)
  • --provider <name>
    — 指定搜索源为"unsplash"或"pexels"(默认同时尝试两个源)

Render SVG to PNG

将SVG渲染为PNG

bash
bunx prez-image render diagram.svg -o deck/public/diagram.png
Converts an SVG file to a PNG. Use this when you've written an SVG (diagram, flowchart, icon, pattern) and need a raster image.
Options:
  • -o, --output <path>
    — output file (required)
  • -w, --width <px>
    — output width, default 1280
bash
bunx prez-image render diagram.svg -o deck/public/diagram.png
将SVG文件转换为PNG格式。当你已设计好SVG(如图表、流程图、图标、图案)并需要栅格化图片时使用此命令。
选项:
  • -o, --output <path>
    — 输出文件路径(必填)
  • -w, --width <px>
    — 输出图片宽度,默认1280像素

Workflow

工作流程

  1. Decide what kind of image you need (see "When to use" above)
  2. Run the appropriate command, saving to
    deck/public/
  3. Reference in slides as
    <img src="/filename.png" />
  1. 确定你需要的图片类型(参考上方“使用场景”)
  2. 运行对应的命令,将图片保存至
    deck/public/
    目录
  3. 在幻灯片中通过
    <img src="/filename.png" />
    引用图片

Example: full slide with generated background

示例:带生成背景的完整幻灯片

bash
bunx prez-image gen "abstract dark gradient with subtle geometric shapes" -o deck/public/bg-hero.png
tsx
<Slide>
  <div className="relative h-full w-full">
    <img src="/bg-hero.png" className="absolute inset-0 w-full h-full object-cover" />
    <div className="relative z-10 flex flex-col items-center justify-center h-full text-white">
      <h1 className="text-8xl font-black">Launch Day</h1>
    </div>
  </div>
</Slide>
bash
bunx prez-image gen "abstract dark gradient with subtle geometric shapes" -o deck/public/bg-hero.png
tsx
<Slide>
  <div className="relative h-full w-full">
    <img src="/bg-hero.png" className="absolute inset-0 w-full h-full object-cover" />
    <div className="relative z-10 flex flex-col items-center justify-center h-full text-white">
      <h1 className="text-8xl font-black">Launch Day</h1>
    </div>
  </div>
</Slide>

Example: SVG diagram rendered to PNG

示例:SVG图表渲染为PNG

Write an SVG file, render it, use it:
bash
bunx prez-image render /tmp/architecture.svg -o deck/public/architecture.png
tsx
<Slide>
  <div className="flex items-center justify-center h-full bg-white p-16">
    <img src="/architecture.png" className="max-h-full" />
  </div>
</Slide>
编写SVG文件,渲染后使用:
bash
bunx prez-image render /tmp/architecture.svg -o deck/public/architecture.png
tsx
<Slide>
  <div className="flex items-center justify-center h-full bg-white p-16">
    <img src="/architecture.png" className="max-h-full" />
  </div>
</Slide>

Tips

小贴士

  • Save images to
    deck/public/
    so Vite serves them at the root path
  • Use
    -w 1280 -h 720
    for full-bleed slide backgrounds (this is the default)
  • Use
    --seed
    with gen to get reproducible results while iterating
  • For search, landscape orientation is automatically requested to match slide aspect ratio
  • You can generate multiple images in parallel by running several commands
  • 将图片保存至
    deck/public/
    目录,以便Vite在根路径提供访问
  • 对于全屏幻灯片背景,使用
    -w 1280 -h 720
    参数(此为默认值)
  • 在使用
    gen
    命令时,配合
    --seed
    参数可获得可复现的生成结果
  • 搜索图片时,会自动请求横版图片以匹配幻灯片的宽高比
  • 可同时运行多个命令,并行生成多张图片