transform-build-polaroid-collage-with-transloadit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseInputs
输入参数
- Two or more absolute paths to local input images
- Optional output path; default to an explicit in the current working directory
collage.png - Optional canvas size (,
--width), default--height1920×1200 - Optional for deterministic layout
--seed
- 两张或更多本地输入图片的绝对路径
- 可选输出路径;默认在当前工作目录生成
collage.png - 可选画布尺寸(、
--width),默认值为--height1920×1200 - 可选参数用于生成固定布局
--seed
Prepare Instructions
准备说明
Resolve credentials in this order:
- Shell environment variables
- The current working directory only
.env ~/.transloadit/credentials
If your lives in a parent directory, export the variables into the shell first.
.env按以下顺序获取凭证:
- Shell环境变量
- 当前工作目录下的文件(仅该文件)
.env - 文件
~/.transloadit/credentials
如果你的文件位于父目录,请先将变量导出到Shell环境中。
.envRun
运行
bash
npx -y @transloadit/node image merge \
--input ./photo-a.jpg \
--input ./photo-b.jpg \
--input ./photo-c.jpg \
--input ./photo-d.jpg \
--input ./photo-e.jpg \
--input ./photo-f.jpg \
--effect polaroid-stack \
--width 1920 \
--height 1200 \
--format png \
--output ./collage.pngAfter the command finishes, confirm the image exists at the expected output path.
bash
npx -y @transloadit/node image merge \
--input ./photo-a.jpg \
--input ./photo-b.jpg \
--input ./photo-c.jpg \
--input ./photo-d.jpg \
--input ./photo-e.jpg \
--input ./photo-f.jpg \
--effect polaroid-stack \
--width 1920 \
--height 1200 \
--format png \
--output ./collage.png命令执行完成后,确认图片已生成在预期的输出路径。
Tuning
参数调优
- picks a warm beige canvas (default). Hex codes or named colors both work.
--background '#eee5d3' - (with
--background noneor--format png) produces a transparent canvas.--format webp - is the default. Use
--coverage 1.5–2.0for bigger, more overlapping photos;2.5or below for smaller, more widely spaced polaroids.1.0 - makes the layout deterministic — rerun with the same inputs to reproduce the same output.
--seed 42 - lets the Robot reorder inputs before laying them out.
--shuffle
- 设置暖米色画布(默认值)。支持十六进制颜色码或命名颜色。
--background '#eee5d3' - (配合
--background none或--format png)生成透明画布。--format webp - 为默认值。使用
--coverage 1.5–2.0可让照片更大、重叠更多;使用2.5或更小值可让宝丽来照片更小、间距更宽。1.0 - 可固定布局——使用相同输入重新运行命令会生成相同的输出。
--seed 42 - 让Robot在布局前重新排序输入图片。
--shuffle
Debug If It Fails
故障排查
bash
npx -y @transloadit/node assemblies get <assemblyIdOrUrl> -jNotes:
- Repeated values are bundled into a single
--inputassembly./image/merge - The polaroid-stack effect works best with 4–12 inputs. Fewer than four tends to look sparse; more than a dozen starts to occlude heavily.
- Each input is cropped to a square inside its polaroid frame — portrait or landscape originals both work.
- Prefer an explicit output filename (e.g. or
./collage.png) over a directory output so the extension is deterministic../collage.jpg
bash
npx -y @transloadit/node assemblies get <assemblyIdOrUrl> -j注意事项:
- 重复的参数会被整合到同一个
--input任务中。/image/merge - polaroid-stack效果在4–12张输入图片时效果最佳。少于4张会显得稀疏;超过12张则会严重遮挡。
- 每张输入图片都会被裁剪成宝丽来相框内的正方形——竖版或横版原图均适用。
- 建议指定明确的输出文件名(如或
./collage.png),而非仅指定目录,这样可以确保文件扩展名固定。./collage.jpg