transform-build-polaroid-collage-with-transloadit

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Inputs

输入参数

  • Two or more absolute paths to local input images
  • Optional output path; default to an explicit
    collage.png
    in the current working directory
  • Optional canvas size (
    --width
    ,
    --height
    ), default
    1920×1200
  • Optional
    --seed
    for deterministic layout
  • 两张或更多本地输入图片的绝对路径
  • 可选输出路径;默认在当前工作目录生成
    collage.png
  • 可选画布尺寸(
    --width
    --height
    ),默认值为
    1920×1200
  • 可选
    --seed
    参数用于生成固定布局

Prepare Instructions

准备说明

Resolve credentials in this order:
  • Shell environment variables
  • The current working directory
    .env
    only
  • ~/.transloadit/credentials
If your
.env
lives in a parent directory, export the variables into the shell first.
按以下顺序获取凭证:
  • Shell环境变量
  • 当前工作目录下的
    .env
    文件(仅该文件)
  • ~/.transloadit/credentials
    文件
如果你的
.env
文件位于父目录,请先将变量导出到Shell环境中。

Run

运行

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
After 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

参数调优

  • --background '#eee5d3'
    picks a warm beige canvas (default). Hex codes or named colors both work.
  • --background none
    (with
    --format png
    or
    --format webp
    ) produces a transparent canvas.
  • --coverage 1.5
    is the default. Use
    2.0
    2.5
    for bigger, more overlapping photos;
    1.0
    or below for smaller, more widely spaced polaroids.
  • --seed 42
    makes the layout deterministic — rerun with the same inputs to reproduce the same output.
  • --shuffle
    lets the Robot reorder inputs before laying them out.
  • --background '#eee5d3'
    设置暖米色画布(默认值)。支持十六进制颜色码或命名颜色。
  • --background none
    (配合
    --format png
    --format webp
    )生成透明画布。
  • --coverage 1.5
    为默认值。使用
    2.0
    2.5
    可让照片更大、重叠更多;使用
    1.0
    或更小值可让宝丽来照片更小、间距更宽。
  • --seed 42
    可固定布局——使用相同输入重新运行命令会生成相同的输出。
  • --shuffle
    让Robot在布局前重新排序输入图片。

Debug If It Fails

故障排查

bash
npx -y @transloadit/node assemblies get <assemblyIdOrUrl> -j
Notes:
  • Repeated
    --input
    values are bundled into a single
    /image/merge
    assembly.
  • 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.
    ./collage.png
    or
    ./collage.jpg
    ) over a directory output so the extension is deterministic.
bash
npx -y @transloadit/node assemblies get <assemblyIdOrUrl> -j
注意事项:
  • 重复的
    --input
    参数会被整合到同一个
    /image/merge
    任务中。
  • polaroid-stack效果在4–12张输入图片时效果最佳。少于4张会显得稀疏;超过12张则会严重遮挡。
  • 每张输入图片都会被裁剪成宝丽来相框内的正方形——竖版或横版原图均适用。
  • 建议指定明确的输出文件名(如
    ./collage.png
    ./collage.jpg
    ),而非仅指定目录,这样可以确保文件扩展名固定。