Skip to content
scroll to zoom · drag to pan

TransformOptions

type TransformOptions = {
dpr?: 1 | 2 | 3;
duration?: number;
effect?: TransformEffect;
fit?: TransformFit;
format?: TransformFormat;
gravity?: TransformGravity;
height?: number;
start?: number;
width?: TransformWidth;
};

Defined in: packages/asset-client/dist/index.d.ts:289

optional dpr?: 1 | 2 | 3;

Defined in: packages/asset-client/dist/index.d.ts:338

Device pixel ratio. Width/height are multiplied by this before resize.


optional duration?: number;

Defined in: packages/asset-client/dist/index.d.ts:366

Video-only: clip duration in seconds (1..300). Image transforms ignore. With start, lets a single request grab a sub-clip.


optional effect?: TransformEffect;

Defined in: packages/asset-client/dist/index.d.ts:356

AI effect applied before resize/encode.

  • removebg: remove the background; output is a transparent PNG of the foreground subject. Forces format=png regardless of other format hints. A single cache miss per (sha, dsl) tuple; subsequent identical DSLs serve from cache — no inference, no per-image cost.

  • genfill: aspect-extension outpaint. Requires BOTH width and height — 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 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/dist/index.d.ts:301

Resize fit mode. Default cover server-side.


optional format?: TransformFormat;

Defined in: packages/asset-client/dist/index.d.ts:305

Output format. auto → the platform’s policy decides.


optional gravity?: TransformGravity;

Defined in: packages/asset-client/dist/index.d.ts:303

Crop gravity. auto picks the region with the most visual salience.


optional height?: number;

Defined in: packages/asset-client/dist/index.d.ts:299

Target max-side height. Multiplied by dpr server-side.


optional start?: number;

Defined in: packages/asset-client/dist/index.d.ts:361

Video-only: clip start in seconds. Image transforms ignore. Accepts decimals (e.g. 1.5 for sub-second seek).


optional width?: TransformWidth;

Defined in: packages/asset-client/dist/index.d.ts:297

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, so the type forbids them at compile time. Signing does NOT lift this: since doc blindaje WS-6 the edge validates signed and unsigned requests identically.