---
schema_version: 1
route: /t/crane.md
tool: "crane"
---

# sincecutoff.com /t/crane — crane

- name: crane
- kind: cli
- children: none
- homepage: <https://github.com/google/go-containerregistry>

Changes to the tools coding agents drive, since a model's training cutoff, each linked to its first-party source. Check installed versions and limitations before acting; a cutoff date does not establish what a model knows.
Original editorial content: [Apache 2.0](https://sincecutoff.com/v1/data-license.txt), by [0xPatrick](https://0xpatrick.dev). Preserve applicable license and [NOTICE](https://sincecutoff.com/notice.txt) attribution when redistributing. Third-party source text and examples retain their own rights. [License scope and attribution](https://sincecutoff.com/v1/license.json).
To stay current, read the changes feed: [`/v1/changes.md?tool=crane`](https://sincecutoff.com/v1/changes.md?tool=crane) (or `.json`), adding `since=YYYY-MM-DD` for your training cutoff. Entries for registered children are included; the registry itself is `/v1/tools.json`. How to page and save your place: [llms.txt](https://sincecutoff.com/llms.txt).

### mutate.Time and mutate.Canonical accept tarball.LayerOption (2026-08-25)
- slug: mutate-time-and-mutate-canonical-accept-tarball-layeroption-776ec8fe4871
- score: 0.93

How to use it:

When rebuilding an image and needing to preserve its layer compression or media type, pass the matching `tarball.LayerOption` values to `mutate.Time` or `mutate.Canonical`, then set the image and config media types with `mutate.MediaType` and `mutate.ConfigMediaType` as needed.

Examples:

```
img, err := mutate.Time(img, t, tarball.WithCompression(compression.ZStd), tarball.WithMediaType(types.OCILayerZStd))
if err != nil { return err }
img = mutate.MediaType(img, types.OCIManifestSchema1)
img = mutate.ConfigMediaType(img, types. OCIConfigJSON)
```

```
img, err := mutate.Canonical(img, tarball.WithCompression(compression.ZStd), tarball.WithMediaType(types.OCILayerZStd))
if err != nil { return err }
img = mutate.MediaType(img, types.OCIManifestSchema1)
img = mutate.ConfigMediaType(img, types.OCIConfigJSON)
```

- why_it_matters: When rebuilding an image while preserving its layer codec and media types, pass the required layer options and update the manifest and config media types.
- before: Before this change, `mutate.Time` and `mutate.Canonical` accepted no layer options; rebuilt layers were dockerv2+gzip by default.
- sources: <https://github.com/google/go-containerregistry/releases/tag/v0.22.0>, <https://github.com/google/go-containerregistry/pull/2403>, <https://pkg.go.dev/github.com/google/go-containerregistry@v0.22.0/pkg/v1/mutate>, <https://pkg.go.dev/github.com/google/go-containerregistry@v0.22.0/pkg/v1/tarball>
- gotchas: "Version: v0.22.0"; "mutate.Time(img, t, opts...) (required): `img` is the image to mutate; `t` is the timestamp applied to image timestamps; `opts` are optional variadic `tarball.LayerOption` values. Layers default to dockerv2+gzip unless options say otherwise."; "mutate.Canonical(img, opts...) (required): `img` is the image to canonicalize; `opts` are optional variadic `tarball.LayerOption` values."; "tarball.WithCompression(comp): Overrides compression for uncompressed tarballs. For ZStd, use together with `WithMediaType(types.OCILayerZStd)`."; "tarball.WithMediaType(mt): Overrides the layer media type. No mutual-exclusion rule documented."; "mutate.MediaType(img, mt) (required): Sets the image media type."; "mutate.ConfigMediaType(img, mt) (required): Sets the image config media type."; "With no options passed, output is byte identical to before."; "`Time` and `Canonical` can no longer be assigned to a `func(v1.Image) (v1.Image, error)` variable."
