The Vue ImageKit SDK is a Vue-specific wrapper built on top of the core ImageKit JavaScript SDK. It brings ImageKit’s URL generation, transformation, responsive-image handling, and file-upload capabilities to Vue 3 in a lightweight package with full TypeScript support.
Source code is available on GitHub under the MIT license.
The SDK works in both SSR (e.g. Nuxt 3) and CSR (Vite / Vue CLI).
Installation & Setup
Install the SDK via npm, yarn, or pnpm:
npm i @imagekit/vue # or yarn add @imagekit/vue # or pnpm add @imagekit/vue
What's included in the SDK:
Export | Description |
---|---|
Image component | <img> wrapper with automatic src /srcset generation, lazy-loading, transformations, etc. |
Video component | <video> wrapper with automatic URL generation & transformations |
ImageKitProvider component | Provides default urlEndpoint / transformationPosition to all nested Image & Video components |
buildSrc , buildTransformationString | Low-level helpers for manual URL building |
getResponsiveImageAttributes | Generates src , srcset , sizes for a plain HTML <img> |
upload utility | Browser-side file uploads (uses Upload v1 API) |
Error classes | ImageKitInvalidRequestError , ImageKitAbortError , ImageKitUploadNetworkError , ImageKitServerError |
TypeScript types | ImageKitProviderProps , IKImageProps , IKVideoProps , SrcOptions , UploadOptions , UploadResponse , Transformation , GetImageAttributesOptions , and ResponsiveImageAttributes etc. |
Quick example
<script setup lang="ts"> import { Image } from '@imagekit/vue' </script> <template> <Image url-endpoint="https://ik.imagekit.io/your_imagekit_id" src="/profile.png" width="500" height="500" alt="Author photo" /> </template>
To avoid repeating urlEndpoint
everywhere, you can wrap your components in an ImageKitProvider
component. All nested Image
and Video
components will inherit the urlEndpoint
and transformationPosition
props from the provider.
Any children will be rendered as-is, so you can use it to wrap your entire app or just a part of it.
<script setup lang="ts"> import { ImageKitProvider, Image } from '@imagekit/vue' </script> <template> <ImageKitProvider url-endpoint="https://ik.imagekit.io/your_imagekit_id"> <Image src="/profile.png" width="500" height="500" alt="Author photo" /> </ImageKitProvider> </template>
Image component
The Image
component is a wrapper around the HTML img
element. It allows you to use ImageKit’s URL generation and transformation, lazy-loading, responsive images etc.
It accepts every regular <img>
attribute plus the following ImageKit-specific props. All other attributes (class, id, data-, aria-, etc.) are forwarded untouched except srcset
. The SDK will generate the srcset
attribute automatically and ignore any custom srcset
you provide.
Parameter | Description and Example |
---|---|
urlEndpoint | The base URL endpoint from your ImageKit dashboard. To avoid passing this prop in every component, you can wrap your components in an Example: |
src | A relative or absolute path to the image.
Examples: |
width | The width of the image in pixels (in numbers). This is used to calculate the srcSet attribute and is only utilized when sizes is not provided. The prop is set on the Example: |
transformation | An array of transformation objects. Each object can include properties like Example: See all supported transformation options and how to handle unsupported transformations. |
queryParameters | An object with additional query parameters to append to the URL. Example: { v: 2 } |
responsive | A boolean that determines if responsive image functionality is enabled. By default, this is true , meaning that a srcset attribute is automatically generated for responsive images. Set it to false to disable this behavior and only apply explicitly defined transformations. |
deviceBreakpoints | It allows you to specify a list of device width breakpoints. Defaults to |
imageBreakpoints | It allows you to specify a list of image width breakpoints. It is concatenated with Defaults to |
transformationPosition | Specifies whether the transformation string is included in the URL path or as a query parameter. Defaults to "query" .Example: "query" or "path" |
Video component
The Video
component is a lightweight wrapper around the HTML video
element. It allows you to use ImageKit’s URL generation and transformation capabilities. It supports all HTML video attributes and additionally accepts the following ImageKit-specific props - urlEndpoint
, transformation
, transformationPosition
, and queryParameters
. For the definition of these props, refer to the Image component section.
<Video url-endpoint="https://ik.imagekit.io/your_imagekit_id" src="/movie.mp4" controls width="640" height="360" />
Height and Width Transformations
With ImageKit, you can resize images on the fly using the width
and height
properties. The SDK automatically generates the appropriate URL with the specified dimensions.
<Image url-endpoint="https://ik.imagekit.io/your_imagekit_id" src="/photo.jpg" width="300" height="300" :transformation="[{ width: 300, height: 300 }]" alt="Square thumb" />
Responsive Images
The <Image>
component in Vue SDK comes with built-in support for responsive images, enabled by default. It automatically generates the appropriate srcset
attributes ensuring images are delivered in the most optimal dimension for various screen sizes.
Behind the scenes, it utilizes the getResponsiveImageAttributes
helper from the core JavaScript SDK to compute these responsive attributes.
To disable responsive behavior, simply set the responsive
prop to false
. This will prevent the component from generating the srcset
attributes automatically.
Note: If you have enabled the "Restrict unnamed transformations" setting (see Basic Security), hardcoded width/crop transformations may be added by default causing request failures. Setting responsive
to false
prevents these additional transformations from being applied.
Lazy Loading Images
The Image
component supports lazy loading by default. You can control this behavior using the loading
prop.
By default, loading
is set to lazy
, which defers loading the image until it is near the viewport.
If set to eager
, the image loads immediately.
<Image url-endpoint="https://ik.imagekit.io/your_imagekit_id" src="/photo.jpg" width="300" height="300" loading="eager" alt="Eager load" />
Lazy Loading Videos
To lazy load a video using Video
component, you can set the preload
attribute to none
and specify a poster
image by extracting a thumbnail from the video.
The buildSrc
utility function is used to generate the thumbnail URL. It accepts the same parameters as the Video
/Image
component and returns a URL with the specified transformations.
Refer to the create thumbnail documentation for detailed instructions on generating a thumbnail from a video using ImageKit.
<script setup lang="ts"> import { Video, buildSrc } from '@imagekit/vue' const posterUrl = buildSrc({ urlEndpoint: 'https://ik.imagekit.io/your_imagekit_id', src: '/movie.mp4/ik-thumbnail.jpg' }) </script> <template> <Video url-endpoint="https://ik.imagekit.io/your_imagekit_id" src="/movie.mp4" preload="none" controls :poster="posterUrl" /> </template>
Chained Transformations
You can chain multiple transformations together by passing an array of transformation objects. Each object can specify different properties, such as width, height, cropping, overlays, and effects. See chained transformations for more details.
<Image url-endpoint="https://ik.imagekit.io/your_imagekit_id" src="/profile.png" :transformation="[ { width: 400, height: 300 }, { rotation: 90 } ]" width="400" height="300" alt="Rotated" />
Adding Overlays
You can add overlays to images and videos. The overlay can be a text, image, video, or subtitle.
Besides the overlay type, you can also specify the position, size, and other properties of the overlay. Check the overlay options for more details.
Image Overlay
<Image url-endpoint="https://ik.imagekit.io/your_imagekit_id" src="/background.png" :transformation="[ { overlay: { type: 'image', input: 'logo.png' } } ]" width="400" height="300" alt="Background with image overlay" />
You can independently transform the overlay image by passing a transformation array inside the overlay
object. The transformation will be applied to the overlay image only.
<Image url-endpoint="https://ik.imagekit.io/your_imagekit_id" src="/background.png" :transformation="[ { overlay: { type: 'image', input: 'logo.png', transformation: [{ width: 100, height: 100 }] } } ]" width="400" height="300" alt="Background with image overlay" />
Image overlays support a wide range of transformations. Check reference for the complete list of transformations supported on image overlays.
Solid Color Overlay
You can add a solid color overlay to images and videos.
<Image url-endpoint="https://ik.imagekit.io/your_imagekit_id" src="/background.jpg" width="400" height="300" :transformation="[ { overlay: { type: 'solidColor', color: 'FF0000', } } ]" />
You can also specify the width, height, and other properties of the solid color overlay. For example:
<Image url-endpoint="https://ik.imagekit.io/your_imagekit_id" src="/background.jpg" width="400" height="300" :transformation="[ { overlay: { type: 'solidColor', color: 'FF0000', transformation: [ { width: 100, height: 100 } ] } } ]" />
For more options related to styling the solid color overlay, check the solid color overlay transformations section.
Text Overlay
You can add text overlays to images and videos.
<Image url-endpoint="https://ik.imagekit.io/your_imagekit_id" src="/background.jpg" width="400" height="300" :transformation="[ { overlay: { type: 'text', text: 'Hello World', } } ]" />
You can also specify the font size, color, and other properties of the text overlay. For example:
<Image url-endpoint="https://ik.imagekit.io/your_imagekit_id" src="/background.jpg" width="400" height="300" :transformation="[ { overlay: { type: 'text', text: "Hello, ImageKit!", transformation: [ { fontSize: 20, fontColor: 'FF0000' } ] } } ]" />
Check the text overlay transformations section for more options related to styling the text.
Video Overlay
You can add video overlays on videos only.
<Video url-endpoint="https://ik.imagekit.io/your_imagekit_id" src="/background.mp4" controls :transformation="[ { overlay: { type: 'video', input: 'overlay.mp4', } } ]" />
Additionally, you can specify the start and duration for the overlay video. For example:
<Video url-endpoint="https://ik.imagekit.io/your_imagekit_id" src="/background.mp4" controls :transformation="[ { overlay: { type: 'video', input: 'overlay.mp4', timing: { start: 5, duration: 10 } } } ]" />
You can also independently transform the overlay video. For example, to resize the overlay video:
<Video url-endpoint="https://ik.imagekit.io/your_imagekit_id" src="/background.mp4" controls :transformation="[ { overlay: { type: 'video', input: 'overlay.mp4', transformation: [{ width: 100, height: 100 }] } } ]" />
All supported video transformations can also be applied to overlay videos.
If you're overlaying an image on a base video, refer to this list for all the transformations supported on image overlays.
Subtitle Overlay
You can add subtitle overlays on videos.
<Video url-endpoint="https://ik.imagekit.io/your_imagekit_id" src="/background.mp4" controls :transformation="[ { overlay: { type: 'subtitle', input: 'subtitle.srt', } } ]" />
The subtitle overlay can be styled with various properties such as font size, color, and outline. See the Subtitle Overlay Transformations section for all styling options.
Background Removal Using AI
<Image url-endpoint="https://ik.imagekit.io/your_imagekit_id" src="/photo.jpg" alt="Photo with background removal" width="400" height="300" :transformation="[ { aiRemoveBackground: true } ]" />
ImageKit supports multiple AI-powered transformations, like upscaling, generative fill, and more More examples:
<Image url-endpoint="https://ik.imagekit.io/your_imagekit_id" src="/photo.jpg" alt="Photo with AI drop shadow" width="400" height="300" :transformation="[ { aiDropShadow: true } ]" />
Upscaling example:
<Image url-endpoint="https://ik.imagekit.io/your_imagekit_id" src="/photo.jpg" alt="Photo with AI upscaling" width="400" height="300" :transformation="[ { aiUpscale: true } ]" />
Arithmetic Expressions
You can use arithmetic expressions to dynamically compute transformation values. For example, to set the width to half of the original image width:
<Image url-endpoint="https://ik.imagekit.io/your_imagekit_id" src="/photo.jpg" alt="Photo with arithmetic width" width="400" height="300" :transformation="[ { width: "iw_div_2" } ]" />
Check out the Arithmetic Expressions reference for more examples and details.
Uploading Files
The Vue.js SDK exports a utility function, .upload
, which enables you to upload files to ImageKit. This upload()
function leverages the Upload V1 API, accepting an options object and returning a promise that resolves with the upload response.
The SDK automatically converts certain parameters into JSON strings, as required by the API. If a parameter is not explicitly supported by the SDK, it is included in the request as-is. For a complete list of parameters and expected formats, refer to the API documentation.
upload() Parameters
The upload()
function accepts a JSON object with the following parameters:
Option | Description and Example |
---|---|
file (Required) | The file content to be uploaded. Accepts binary data, a base64-encoded string, or a URL. Typically used with a File or Blob in the browser. Example: file: fileInput.files[0] |
fileName (Required) | The name to assign to the uploaded file. Supports alphanumeric characters, dot, underscore, and dash. Any other character is replaced with _ . Example: fileName: "myImage.jpg" |
signature (Required) | The HMAC-SHA1 digest of the concatenation of "token + expire". The signing key is your ImageKit private API key. Must be computed on the server side. Example: signature: "generated_signature" |
token | A unique value to identify and prevent replays. Typically a UUID (e.g., version 4). Example: Check the generating authentication parameters section for more details on how to generate this value. |
expire | A Unix timestamp in seconds, less than 1 hour in the future. Example: Check the generating authentication parameters section for more details on how to generate this value. |
publicKey | The public API key for your ImageKit account. This is used to identify the account making the upload request. Example: Check the generating authentication parameters section for more details on how to generate this value. |
onProgress | A callback function to track the upload progress. It receives an event object with loaded and total properties. Example: onProgress: (event) => console.log(event.loaded, event.total) This is useful for showing upload progress to the user. |
abortSignal | An optional AbortSignal object to abort the upload request. If the signal is already aborted, the upload will fail immediately. You can create an AbortController instance and pass its signal to the upload() function. |
useUniqueFileName | Boolean flag to automatically generate a unique filename if set to true. Defaults to true. If false, the image is uploaded with the provided filename, replacing any existing file with the same name. Example: useUniqueFileName: true |
folder | The folder path where the file will be stored, e.g., "/images/folder/". If the path doesn't exist, it is created on-the-fly. Example: folder: "/images/uploads" |
isPrivateFile | Boolean to mark the file as private, restricting access to the original file URL. A private file requires signed URLs or named transformations for access. Defaults to false. Example: isPrivateFile: false |
tags | Optionally set tags on the uploaded file. Can be a comma-separated string or an array of tags. Example: tags: "summer,holiday" or tags: ["summer","holiday"] |
customCoordinates | A string in "x,y,width,height" format that defines the region of interest in an image (top-left coords and area size). Example: customCoordinates: "10,10,100,100" |
responseFields | A comma-separated or array-based set of fields to return in the upload response. Example: responseFields: "tags,customCoordinates" |
extensions | An array of extension objects to apply to the image, e.g., background removal, auto-tagging, etc. Example: extensions: [{ name: "auto-tagging" }] |
webhookUrl | A webhook URL to receive the final status of any pending extensions once they've completed processing. Example: webhookUrl: "https://example.com/webhook" |
overwriteFile | Defaults to true. If false, and "useUniqueFileName" is also false, the API immediately fails if a file with the same name/folder already exists. Example: overwriteFile: true |
overwriteAITags | Defaults to true. If true, and an existing file is found at the same location, its AITags are removed. Set to false to keep existing AITags. Example: overwriteAITags: true |
overwriteTags | Defaults to true. If no tags are specified in the request, existing tags are removed from overwritten files. Setting to false has no effect if the request includes tags. Example: overwriteTags: true |
overwriteCustomMetadata | Defaults to true. If no customMetadata is specified in the request, existing customMetadata is removed from overwritten files. Setting to false has no effect if the request specifies customMetadata. Example: overwriteCustomMetadata: true |
customMetadata | A stringified JSON or an object containing custom metadata fields to store with the file. Custom metadata fields must be pre-defined in your ImageKit configuration. Example: customMetadata: {author: "John Doe"} |
transformation | Defines pre and post transformations to be applied to the file during upload. The SDK enforces certain validation rules for pre/post transformations. Example: transformation: { pre: "w-200,h-200", post: [...] } |
xhr | An optional XMLHttpRequest instance for the upload. The SDK merges it with its own logic to handle progress events, etc. Example: xhr: new XMLHttpRequest() |
checks | A string specifying the checks to be performed server-side before uploading to the media library, e.g., size or mime type checks. Example: checks: "file.size' < '1MB'" |
Upload Example and Error Handling
The .upload
function expects the following mandatory parameters:
file
andfileName
– The file to be uploaded and the name you want to assign to it. Thefile
value can be aFile
object, a base64-encoded string, or a URL.- Authentication parameters –
token
,signature
,expire
, andpublicKey
.
Authentication is essential for secure file uploads from the browser. You should never expose your private API key in client-side code. Instead, generate these one-time authentication parameters on the server side and pass them to the client.
To simplify the process, all of our backend SDKs include utility functions for generating authentication parameters.
Upload Flow Overview
Here’s how the upload process using the SDK works:
Client Request for Auth Parameters
The client component calls an API route to fetch the authentication parameters.
You can implement your own application logic within this route to authenticate the user.
After that, use one of our backend SDKs to generate the required auth parameters and return them to the client.File Upload
Once the client has the auth parameters, it can call the.upload
function with the necessary data.
Generating Authentication Parameters
The following example demonstrates how to create an API route that generates authentication parameters using the ImageKit Node.js SDK.
You can find your private key and public key in the ImageKit dashboard.
const express = require('express'); const app = express(); const ImageKit = require('imagekit'); // Node.js SDK const imagekit = new ImageKit({ urlEndpoint: '<YOUR_IMAGEKIT_URL_ENDPOINT>', // https://ik.imagekit.io/your_imagekit_id publicKey: process.env.IMAGEKIT_PUBLIC_KEY, privateKey: process.env.IMAGEKIT_PRIVATE_KEY }); // allow cross-origin requests app.use(function(req, res, next) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); next(); }); app.get('/auth', function (req, res) { // Your application logic to authenticate the user // For example, you can check if the user is logged in or has the necessary permissions // If the user is not authenticated, you can return an error response const { token, expire, signature } = imagekit.getAuthenticationParameters(); res.send({ token, expire, signature, publicKey: process.env.IMAGEKIT_PUBLIC_KEY }); }); app.listen(3000, function () { console.log('Live at Port 3000'); });
Now your client-side code can call this API route to retrieve the upload parameters.
The example below demonstrates how to use the .upload
function in a client component to upload a file, including error handling for various upload scenarios. You can copy and paste this code into your client component and customize it as needed.
<script setup lang="ts"> import { upload, ImageKitAbortError, ImageKitInvalidRequestError, ImageKitUploadNetworkError, ImageKitServerError } from '@imagekit/vue' import { ref } from 'vue' const progress = ref(0) const fileInput = ref<HTMLInputElement>() const aborter = new AbortController() async function authenticate() { const res = await fetch('/api/auth') if (!res.ok) throw new Error(await res.text()) return (await res.json()) as { signature: string; expire: number; token: string; publicKey: string } } async function handleUpload() { const file = fileInput.value?.files?.[0] if (!file) return alert('Choose a file') let creds try { creds = await authenticate() } catch (e) { return console.error('Auth failed', e) } try { const resp = await upload({ ...creds, file, fileName: file.name, onProgress: e => (progress.value = e.loaded / e.total * 100), abortSignal: aborter.signal }) console.log('Upload OK', resp) } catch (err) { if (err instanceof ImageKitAbortError) console.warn('Aborted') else if (err instanceof ImageKitInvalidRequestError) console.error('Bad request') else if (err instanceof ImageKitUploadNetworkError) console.error('Network') else if (err instanceof ImageKitServerError) console.error('Server side') else console.error(err) } } </script> <template> <input type="file" ref="fileInput" /> <button @click="handleUpload">Upload</button> <progress :value="progress" max="100" /> </template>
Supported Transformations
The SDK assigns a name to each transformation parameter (e.g., height
maps to h
, width
maps to w
). If the property does not match any of the following supported options, it is added as is in the URL.
If you want to generate transformations without any modifications, use the raw
parameter. For example, SDK doesn't provide a nice way to write conditional transformations, so you can use the raw
parameter to add them as is.
Check transformation documentation for complete reference on all transformations supported by ImageKit.
Transformation Name | URL Parameter |
---|---|
width | w |
height | h |
aspectRatio | ar |
quality | q |
aiRemoveBackground | e-bgremove (ImageKit powered) |
aiRemoveBackgroundExternal | e-removedotbg (Using third party) |
aiUpscale | e-upscale |
aiRetouch | e-retouch |
aiVariation | e-genvar |
aiDropShadow | e-dropshadow |
aiChangeBackground | e-changebg |
crop | c |
cropMode | cm |
x | x |
y | y |
xCenter | xc |
yCenter | yc |
focus | fo |
format | f |
radius | r |
background | bg |
border | b |
rotation | rt |
blur | bl |
named | n |
dpr | dpr |
progressive | pr |
lossless | lo |
trim | t |
metadata | md |
colorProfile | cp |
defaultImage | di |
original | orig |
videoCodec | vc |
audioCodec | ac |
grayscale | e-grayscale |
contrastStretch | e-contrast |
shadow | e-shadow |
sharpen | e-sharpen |
unsharpMask | e-usm |
gradient | e-gradient |
flip | fl |
opacity | o |
zoom | z |
page | pg |
startOffset | so |
endOffset | eo |
duration | du |
streamingResolutions | sr |
overlay | Generates the correct layer syntax for image, video, text, subtitle, and solid color overlays. |
raw | The string provided in raw will be added in the URL as is. |
Handling Unsupported Transformations
If you specify a transformation parameter that is not explicitly supported by the SDK, it is added “as-is” in the generated URL. This provides flexibility for using new or custom transformations without waiting for an SDK update. However add @ts-ignore
to avoid TypeScript errors for unsupported transformations, or add transformation as a string in the raw
parameter.
For example:
buildSrc({ urlEndpoint: "https://ik.imagekit.io/your_imagekit_id", src: "/photo.jpg", transformation: [ { unsupportedTransformation: "value" } ] }); // Output: https://ik.imagekit.io/your_imagekit_id/photo.jpg?tr=unsupportedTransformation-value
Overlay Reference
This SDK provides overlay
as a transformation parameter. The overlay can be a text, image, video, subtitle, or solid color.
Overlays in ImageKit are applied using layers, allowing you to stack multiple overlays on top of each other. Each overlay can be styled and positioned independently. For more details, refer to the layer documentation.
The SDK automatically generates the correct layer syntax for image, video, text, subtitle, and solid color overlays. You can also specify the overlay position, size, and other properties.
The table below outlines the available overlay configuration options:
Option | Description and Example |
---|---|
type (Required) | Specifies the type of overlay. Supported values: text , image , video , subtitle , solidColor . Example: type: "text" |
text (Required for text overlays) | The text content to display. Example: text: "ImageKit" |
input (Required for image, video, or subtitle overlays) | Relative path to the overlay asset. Example: input: "logo.png" or input: "overlay-video.mp4" |
color (Required for solidColor overlays) | RGB/RGBA hex code or color name for the overlay color. Example: color: "FF0000" |
encoding | Accepted values: auto , plain , base64 . Check this for more details. Example: encoding: "auto" |
transformation | An array of transformation objects to style the overlay independently of the base asset. Each overlay type has its own set of supported transformations.
|
position | Sets the overlay’s position relative to the base asset. Accepts an object with x , y , or focus . Example: position: { x: 10, y: 20 } or position: { focus: "center" } |
timing | (For video base) Specifies when the overlay appears using start , duration , and end (in seconds); if both duration and end are set, duration is ignored. Example: timing: { start: 5, duration: 10 } |
Encoding Options
Overlay encoding options define how the overlay input is converted for URL construction. When set to auto
, the SDK automatically determines whether to use plain text or Base64 encoding based on the input content.
For text overlays:
- If
auto
is used, the SDK checks the text overlay input: if it is URL-safe, it uses the formati-{input}
(plain text); otherwise, it applies Base64 encoding with the formatie-{base64_encoded_input}
. - You can force a specific method by setting encoding to
plain
(always usei-{input}
) orbase64
(always useie-{base64}
). - Note: In all cases, the text is percent-encoded to ensure URL safety.
For image, video, and subtitle overlays:
- The input path is processed by removing any leading/trailing slashes and replacing inner slashes with
@@
whenplain
is used. - Similarly, if
auto
is used, the SDK determines whether to apply plain text or Base64 encoding based on the characters present. - For explicit behavior, use
plain
orbase64
to enforce the desired encoding.
Use auto
for most cases to let the SDK optimize encoding, and use plain
or base64
when a specific encoding method is required.
Solid Color Overlay Transformations
Option | Description | Example |
---|---|---|
width | Specifies the width of the solid color overlay block (in pixels or as an arithmetic expression). | width: 100 |
height | Specifies the height of the solid color overlay block (in pixels or as an arithmetic expression). | height: 50 |
radius | Specifies the corner radius of the solid color overlay block or shape. Can be a number or "max" for circular/oval shapes. | radius: "max" |
alpha | Specifies the transparency level of the solid color overlay. Supports integers from 1 (most transparent) to 9 (least transparent). | alpha: 5 |
background | Specifies the background color of the solid color overlay. Accepts an RGB hex code, an RGBA code, or a standard color name. | background: "red" |
gradient | Only works if base asset is an image. Creates a linear gradient with two colors. Pass true for a default gradient, or provide a string for a custom gradient. Learn more | gradient: true |
Text Overlay Transformations
Option | Description | Example |
---|---|---|
width | Specifies the maximum width (in pixels) of the overlaid text. The text wraps automatically, and arithmetic expressions are supported (e.g., bw_mul_0.2 or bh_div_2 ). | width: 400 |
fontSize | Specifies the font size of the overlaid text. Accepts a numeric value or an arithmetic expression. | fontSize: 50 |
fontFamily | Specifies the font family of the overlaid text. Choose from the supported fonts or provide a custom font. | fontFamily: "Arial" |
fontColor | Specifies the font color of the overlaid text. Accepts an RGB hex code, an RGBA code, or a standard color name. | fontColor: "FF0000" |
innerAlignment | Specifies the inner alignment of the text when it doesn’t occupy the full width. Supported values: left , right , center . | innerAlignment: "center" |
padding | Specifies the padding around the text overlay. Can be a single integer or multiple values separated by underscores; arithmetic expressions are accepted. | padding: 10 |
alpha | Specifies the transparency level of the text overlay. Accepts an integer between 1 and 9 . | alpha: 5 |
typography | Specifies the typography style of the text. Supported values: b for bold, i for italics, and b_i for bold with italics. | typography: "b" |
background | Specifies the background color of the text overlay. Accepts an RGB hex code, an RGBA code, or a color name. | background: "red" |
radius | Specifies the corner radius of the text overlay. Accepts a numeric value or max for circular/oval shape. | radius: "max" |
rotation | Specifies the rotation angle of the text overlay. Accepts a numeric value for clockwise rotation or a string prefixed with N for counterclockwise rotation. | rotation: 90 |
flip | Specifies the flip option for the text overlay. Supported values: h , v , h_v , v_h . | flip: "h" |
lineHeight | Specifies the line height for multi-line text. Accepts a numeric value or an arithmetic expression. | lineHeight: 20 |
Subtitle Overlay Transformations
Option | Description | Example |
---|---|---|
background | Specifies the subtitle background color using a standard color name, RGB color code, or RGBA color code. | background: "blue" |
fontSize | Sets the font size of subtitle text. | fontSize: 16 |
fontFamily | Sets the font family of subtitle text. | fontFamily: "Arial" |
color | Specifies the font color of subtitle text using standard color name, RGB, or RGBA color code. | color: "FF0000" |
typography | Sets the typography style of subtitle text. Supported values: b , i , b_i . | typography: "b" |
fontOutline | Specifies the font outline for subtitles. Requires an outline width and color separated by an underscore. | fontOutline: "2_blue" |
fontShadow | Specifies the font shadow for subtitles. Requires shadow color and indent separated by an underscore. | fontShadow: "blue_2" |