# transform-build-mosaic-collage-with-transloadit

Builds one justified mosaic collage from several local photos, center cropping each to fit, and saves it to a file you choose.

Skill by Transloadit. Category: Design and frontend.

## Install

Project (for this project only):

```sh
npx skills add transloadit/skills --skill transform-build-mosaic-collage-with-transloadit
```

Works with: Claude Code, Codex CLI, Cursor, Antigravity, Copilot CLI, opencode.

Global (for every project on this machine):

```sh
npx skills add transloadit/skills --skill transform-build-mosaic-collage-with-transloadit -g
```

Works with: Claude Code, Codex CLI, Cursor, Antigravity, Copilot CLI, opencode.

## Tags

- Runs on your computer: It runs as a program on your machine, with your access.

## Security audits

- Gen Agent Trust Hub: Pass
- Socket: Pass
- Snyk: Pass

Installs: 65. Installs counted by skills.sh. [Open on skills.sh](https://www.skills.sh/transloadit/skills/transform-build-mosaic-collage-with-transloadit)

## Source

[Open the source](https://github.com/transloadit/skills/tree/HEAD/skills/transform-build-mosaic-collage-with-transloadit). Checked 2026-10-10. This summary may contain AI-generated text, so it can be wrong. Check the source before you rely on it.

## SKILL.md

````markdown
---
name: transform-build-mosaic-collage-with-transloadit
description: One-off justified mosaic photo collage (N local images -> single image) using the official `@transloadit/node` CLI. Uses the `/image/merge` Robot's `mosaic` effect to build a justified tiled layout with center-cropped photos, and downloads the result to an explicit output path via `--output`.
when_to_use: |
  Triggers when the user asks to create a mosaic collage, tile photos edge-to-edge, build a justified photo grid, make a Flickr-style photo layout, or compose N photos into a clean editorial collage where center-cropping is acceptable. Choose this over the polaroid skill when the vibe is clean and editorial (product grids, portfolio hero sections, social previews from a batch), and over `transform-generate-image-with-transloadit` when the input is N existing photos rather than a text prompt. Do not choose this effect when every pixel of each input must remain visible.
---

# Inputs

- Two or more absolute paths to local input images
- Optional output path; default to an explicit `collage.jpg` in the current working directory
- Optional canvas size (`--width`, `--height`), default `1920×1200`
- Optional `--seed` for deterministic layout

# 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.

# 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 mosaic \
  --width 1920 \
  --height 1200 \
  --border 12 \
  --shuffle \
  --format jpg \
  --output ./collage.jpg
```

After the command finishes, confirm the image exists at the expected output path.

# Tuning

- `--border 12` sets both the outer canvas padding and the gutter width between tiles. Larger values give more breathing room.
- `--background '#eee5d3'` fills the gutters and canvas padding (default). Hex codes or named colors both work.
- `--background none` (with `--format png` or `--format webp`) produces a transparent canvas and transparent gutters.
- `--shuffle` lets the Robot reorder inputs before solving the layout; combine with `--seed` to pin the shuffle.
- `--seed 42` makes the mosaic solver deterministic — rerun with the same inputs to reproduce the same output.

# 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 mosaic effect reads each input's aspect ratio and solves for a justified tile layout — portrait + landscape mixes generally produce more interesting layouts than uniform sizes.
- Tiles are center-cropped to fit their allocated rectangle. Parts of a photo can be cropped off. Resizing inputs beforehand with `/image/resize` and `resize_strategy: fit` does not guarantee that the mosaic layout will preserve every pixel.
- Prefer an explicit output filename (e.g. `./collage.jpg` or `./collage.png`) over a directory output so the extension is deterministic.
````

- Previous: [transform-convert-markdown-to-pdf-with-transloadit](https://syn4pse.dev/terminal/transloadit-transform-convert-markdown-to-pdf-with-transloadit.md)
- Next: [transform-build-polaroid-collage-with-transloadit](https://syn4pse.dev/terminal/transloadit-transform-build-polaroid-collage-with-transloadit.md)
- [Terminal](https://syn4pse.dev/terminal.md)
- [Suggest a change](mailto:terminal@syn4pse.dev?subject=Terminal%20suggestion)
