TransformOptions
type TransformOptions = { dpr?: 1 | 2 | 3; duration?: number; effect?: TransformEffect; fit?: TransformFit; format?: TransformFormat; gravity?: TransformGravity; height?: number; quality?: "auto" | number; start?: number; width?: TransformWidth;};Defined in: packages/asset-client/src/transform.ts:67
Properties
Section titled “Properties”optional dpr?: 1 | 2 | 3;Defined in: packages/asset-client/src/transform.ts:87
Device pixel ratio. Width/height are multiplied by this before resize.
duration?
Section titled “duration?”optional duration?: number;Defined in: packages/asset-client/src/transform.ts:116
Video-only: clip duration in seconds (1..300). Image transforms
ignore. With start, lets a single request grab a sub-clip.
effect?
Section titled “effect?”optional effect?: TransformEffect;Defined in: packages/asset-client/src/transform.ts:106
AI effect applied before resize/encode.
-
removebg: remove the background; output is a transparent PNG of the foreground subject. Forcesformat=pngregardless of other format hints. Runs U²-Net ONNX locally (or BRIA via Replicate whenBG_REMOVAL_BACKEND=replicate). Single cache miss per (sha, dsl) tuple; subsequent identical DSLs serve from R2 — no inference, no per-image cost. -
genfill: aspect-extension outpaint via Flux-Fill Pro on Replicate. Requires BOTHwidthandheight— the server fits the source centered into the target canvas and outpaints the gutters. Output is PNG (forced) at exactly target dims. ~$0.05/image first time; same R2 cache as removebg after. Primary use case: building OG cards (1200×630) from portrait listing photos without awkward edge mirroring.
optional fit?: TransformFit;Defined in: packages/asset-client/src/transform.ts:79
Resize fit mode. Default cover server-side.
format?
Section titled “format?”optional format?: TransformFormat;Defined in: packages/asset-client/src/transform.ts:83
Output format. auto → policy decides (see asset-manager bench).
gravity?
Section titled “gravity?”optional gravity?: TransformGravity;Defined in: packages/asset-client/src/transform.ts:81
Crop gravity. auto uses sharp’s attention strategy.
height?
Section titled “height?”optional height?: number;Defined in: packages/asset-client/src/transform.ts:77
Target max-side height. Multiplied by dpr server-side.
quality?
Section titled “quality?”optional quality?: "auto" | number;Defined in: packages/asset-client/src/transform.ts:85
Output quality. auto → format-specific default.
start?
Section titled “start?”optional start?: number;Defined in: packages/asset-client/src/transform.ts:111
Video-only: clip start in seconds. Image transforms ignore. Accepts decimals (e.g. 1.5 for sub-second seek).
width?
Section titled “width?”optional width?: TransformWidth;Defined in: packages/asset-client/src/transform.ts:75
Target max-side width in CSS pixels (multiplied by dpr server-side).
MUST be a TRANSFORM_WIDTHS value — off-ladder widths are rejected
(HTTP 400) by the edge whitelist for unsigned URLs, so the type forbids
them at compile time. For SIGNED URLs with a custom width, use
SignedTransformOptions (which widens this to number).