prez-image
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseprez-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 from the project root (or if installed locally).
bunx prez-imagenode deck/node_modules/.bin/prez-image所有命令需在项目根目录执行(若本地安装则执行)。
bunx prez-imagenode deck/node_modules/.bin/prez-imageGenerate an image with AI
用AI生成图片
bash
bunx prez-image gen "a dark futuristic cityscape, minimal, cinematic" -o deck/public/hero.pngUses Pollinations.ai (free, no API key required). For higher rate limits, set .
POLLINATIONS_API_KEYOptions:
- — output file (required)
-o, --output <path> - — width, default 1280
-w, --width <px> - — height, default 720
-h, --height <px> - — Pollinations model, default "flux"
--model <name> - — seed for reproducible output
--seed <n>
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> - — 图片宽度,默认1280像素
-w, --width <px> - — 图片高度,默认720像素
-h, --height <px> - — Pollinations模型,默认使用"flux"
--model <name> - — 随机种子,用于生成可复现的结果
--seed <n>
Search for a photo
搜索照片
bash
bunx prez-image search "team collaboration in modern office" -o deck/public/team.jpgSearches Unsplash and Pexels for royalty-free, landscape-oriented photos. Requires at least one API key:
- — free at https://unsplash.com/developers
UNSPLASH_ACCESS_KEY - — free at https://www.pexels.com/api/
PEXELS_API_KEY
Options:
- — output file (required)
-o, --output <path> - — force "unsplash" or "pexels" (default: tries both)
--provider <name>
bash
bunx prez-image search "team collaboration in modern office" -o deck/public/team.jpg在Unsplash和Pexels中搜索免版权的横版照片。需至少配置一个API密钥:
- — 可在https://unsplash.com/developers免费获取
UNSPLASH_ACCESS_KEY - — 可在https://www.pexels.com/api/免费获取
PEXELS_API_KEY
选项:
- — 输出文件路径(必填)
-o, --output <path> - — 指定搜索源为"unsplash"或"pexels"(默认同时尝试两个源)
--provider <name>
Render SVG to PNG
将SVG渲染为PNG
bash
bunx prez-image render diagram.svg -o deck/public/diagram.pngConverts an SVG file to a PNG. Use this when you've written an SVG (diagram, flowchart, icon, pattern) and need a raster image.
Options:
- — output file (required)
-o, --output <path> - — output width, default 1280
-w, --width <px>
bash
bunx prez-image render diagram.svg -o deck/public/diagram.png将SVG文件转换为PNG格式。当你已设计好SVG(如图表、流程图、图标、图案)并需要栅格化图片时使用此命令。
选项:
- — 输出文件路径(必填)
-o, --output <path> - — 输出图片宽度,默认1280像素
-w, --width <px>
Workflow
工作流程
- Decide what kind of image you need (see "When to use" above)
- Run the appropriate command, saving to
deck/public/ - Reference in slides as
<img src="/filename.png" />
- 确定你需要的图片类型(参考上方“使用场景”)
- 运行对应的命令,将图片保存至目录
deck/public/ - 在幻灯片中通过引用图片
<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.pngtsx
<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.pngtsx
<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.pngtsx
<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.pngtsx
<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 so Vite serves them at the root path
deck/public/ - Use for full-bleed slide backgrounds (this is the default)
-w 1280 -h 720 - Use with gen to get reproducible results while iterating
--seed - For search, landscape orientation is automatically requested to match slide aspect ratio
- You can generate multiple images in parallel by running several commands
- 将图片保存至目录,以便Vite在根路径提供访问
deck/public/ - 对于全屏幻灯片背景,使用参数(此为默认值)
-w 1280 -h 720 - 在使用命令时,配合
gen参数可获得可复现的生成结果--seed - 搜索图片时,会自动请求横版图片以匹配幻灯片的宽高比
- 可同时运行多个命令,并行生成多张图片