This page explains how to find a version's layers, and what a replacement can change in one.

A composition is built from layers: each text, image or video in it is one layer. A replacement changes one layer and leaves the rest of the composition as it is. You send replacements in one of three places:

Requests go to https://blitframe.codeartworks.com, with your API key.

Editable layers

An editable layer is a layer that a replacement can change: a text, an image or a video. GET /v1/versions/{versionId}/layers lists these layers of a version. Each layer has a layer id, which a replacement uses to say which layer it changes. For example:

{
  "width": 1920,
  "height": 1080,
  "textLayers": [
    { "layer": "/layers/0", "name": "Headline", "text": "Summer sale", "font": "Montserrat-Bold", "fontSize": 72, "textFit": true }
  ],
  "imageLayers": [
    { "layer": "/layers/3", "name": "Product", "assetId": "image_1", "path": "images/product.png", "width": 800, "height": 800 }
  ],
  "videoLayers": [
    { "layer": "/assets/2/layers/0", "name": "Background", "assetId": "video_1", "path": "video/beach.mp4", "width": 1920, "height": 1080 }
  ],
  "fonts": [
    { "name": "Montserrat-Bold", "family": "Montserrat", "style": "Bold", "source": "library" }
  ],
  "audioFiles": ["audio/music.mp3"],
  "soundtrack": null
}
Field Meaning
layer The layer id: the layer's position in data.json.
textFit true when text fitting fits the layer's text.
path, width, height The file the layer shows, and its size in pixels.
fonts[].source project (a font file in the version), library (the font library) or missing.
audioFiles, soundtrack The version's audio files and soundtrack.
text, name, font, fontSize, assetId, fonts[].name, family, style As data.json has them.

A layer in a precomposition that is used several times changes everywhere it appears.

Replacements

A replacement changes one layer: the text or font of a text layer, or the file that an image or video layer shows. replacements is a list of up to 200 of them, one per layer. Each one names its layer and has these fields:

Layer Field Value
Text text The new text. It cannot be empty.
Text font A font from GET /v1/fonts, such as montserrat-bold, or a font file in the version named Family-Style, such as fonts/Inter-Bold.ttf.
Image or video path A file that is already in the version.
Image or video file A new file: the new path it gets in the version, such as images/new-photo.png, and its content, as contentBase64 or as the uploadId of an upload. In a render or a batch of variations, only uploadId.
Image fit See Fit a new image.
  • A text layer takes text, font or both. An image or video layer takes either path or file.
  • A font file must be in the version already. Add it in an earlier edit.
  • Text keeps its size, color, letter spacing, alignment and animation. To change those for one video, render a draft with an edited data.json.
  • An image can replace a video, and a video an image.

Fit a new image to the layer

The layer keeps its size, and fit says how the new image is placed in it. Blitframe draws the new image into a PNG of the layer's size, stores it next to your file as <name>-fit-<hash>.png, and points the layer at that PNG. Your file stays in the version too.

fit Result
contain (default) The new image fits inside the space the original artwork took, centered. Transparent margins are ignored, so a logo replaces a logo at the same visual size.
cover The new image fills everything the original drew, cropped. Use it for backgrounds.

Video and animated GIF and WebP files are not fitted: use one with the original's aspect ratio. fit is refused for video.

Details

A replacement image can be up to 128 MB. A request can be up to 64 MB. See Limits.

Layer details

  • Layer ids stay the same in versions changed with replacements.
  • A text value over 16,383 characters is cut and ends with …. Read data.json for the whole value.

Replacement details

  • A replaced image or video layer's asset must declare w and h, each from 1 to 4096. Otherwise the replacement is refused with 400 invalid_request.