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/src/transform.ts:78
Properties
Section titled “Properties”optional dpr?: 1 | 2 | 3;Defined in: packages/asset-client/src/transform.ts:127
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:155
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:145
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. 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 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 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:90
Resize fit mode. Default cover server-side.
format?
Section titled “format?”optional format?: TransformFormat;Defined in: packages/asset-client/src/transform.ts:94
Output format. auto → the platform’s policy decides.
gravity?
Section titled “gravity?”optional gravity?: TransformGravity;Defined in: packages/asset-client/src/transform.ts:92
Crop gravity. auto picks the region with the most visual salience.
height?
Section titled “height?”optional height?: number;Defined in: packages/asset-client/src/transform.ts:88
Target max-side height. Multiplied by dpr server-side.
start?
Section titled “start?”optional start?: number;Defined in: packages/asset-client/src/transform.ts:150
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:86
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.