Generate a preview thumbnail
🤖/file/preview generates a thumbnail for any uploaded file to preview its content, similar to the thumbnails in desktop file managers.

This Robot's purpose is to generate a meaningful preview image for any file, in such a way that the resulting thumbnail highlights the file's content. The goal is not to losslessly present the original media in a smaller way. Instead, it is to maximize the chance of a person recognizing the media at a glance, while being visually pleasing and consistent with other previews. The generation process depends on the file type. For example, the Robot can extract artwork from media files, frames from videos, generate a waveform for audio files, and preview the content of documents and images. The strategy parameter lists the available strategies and controls their fallback order.
With the default strategy configuration, a generic icon is the fallback when no file-specific thumbnail can be generated. The default with-text icon style includes the file extension; icon_style and icon_text_content control its appearance.
The default parameters produce still previews at the configured dimensions and format for integration into your application's UI. The optional clip strategy produces animated previews using clip_format. Preview images are optimized by default to reduce their file size while maintaining visual quality.
Usage example
Generate a preview thumbnail for any uploaded file:
{
"steps": {
"previewed": {
"format": "png",
"height": 400,
"robot": "/file/preview",
"use": ":original",
"width": 300
}
}
}Parameters
interpolateboolean | Record<string, boolean>Controls whether Assembly Variables are interpolated for individual instruction fields.
By default, most Robot instruction fields interpolate Assembly Variables. Set this to
falseto treat every instruction field as literal text, or set an individual field path tofalseto treat only that field as literal text. For Robot-specific fields that are literal by default, set this totrueor set that field path totrueto opt back into interpolation.Use field names such as
path, or dotted paths such asffmpeg.vffor nested objects.output_metaRecord<string, boolean> | boolean | Array<string>Allows you to specify a set of metadata that is more expensive on CPU power to calculate, and thus is disabled by default to keep your Assemblies processing fast.
For images, you can add
"has_transparency": truein this object to extract if the image contains transparent parts and"dominant_colors": trueto extract an array of hexadecimal color codes from the image.For images, you can also add
"blurhash": trueto extract a BlurHash string — a compact representation of a placeholder for the image, useful for showing a blurred preview while the full image loads.For images,
"thumbhash": trueinstead extracts a base64-encoded ThumbHash intometa.thumbhash, together withmeta.has_alpha(whether an alpha channel exists, even when fully opaque). It describes EXIF-oriented pixels and uses the first frame of animated images. Extraction is best-effort: images above 40 megapixels, unsupported formats, or a failed/bounded decode produce no placeholder. Successful extraction adds a metadata charge equivalent to 20% of that file's bytes. No ThumbHash surcharge applies when disabled or when no hash is produced.Set this option on the Step producing the image, such as
/upload/handlefor uploaded originals or/image/resizefor processed outputs. Setting it only on/transloadit/storedoes not request extraction: storage preserves the producer's metadata. Transloadit Storage persists a generated hash with its immutable version and returns it in stored results and native asset reads. Direct S3 uploads do not generate placeholders. A placeholder contains image information, so protect it with the same access controls as the full image.For videos, you can add the
"colorspace": trueparameter to extract the colorspace of the output video.For videos, you can also add
"interlaced": trueto detect whether the video is interlaced. This combines the cheap ffprobefield_orderflag with a boundedidetsampling pass over the first frames of the source, exposinginterlaced,field_order, and a diagnosticinterlace_detectionobject underfile.meta. This is computationally expensive and billed accordingly.For audio, you can add
"mean_volume": trueto get a single value representing the mean average volume of the audio file.You can also set this to
falseto skip metadata extraction and speed up transcoding.user_metaRecord<string, any>(default:{})Adds custom JSON metadata to each emitted file without changing its contents. Nested objects and arrays are supported.
Inheritance depends on the Robot. Values merge with existing
user_metaon the output file; the current Step replaces matching top-level keys. Assign required keys explicitly when a Robot creates fresh outputs.In processing Steps,
${file.*}refers to the first input and${result.*}to the emitted file. Values are evaluated per output after the Robot runs, before subsequent metadata extraction and temporary storage. On:original, values are evaluated per upload before metadata extraction.Downstream Steps read
${file.user_meta.key}. See Custom metadata for a complete example and inheritance rules.resultboolean(default:false)Whether the results of this Step should be present in the Assembly Status JSON
queuebatchSetting the queue to 'batch', manually downgrades the priority of jobs for this step to avoid consuming Priority job slots for jobs that don't need zero queue waiting times
force_acceptboolean(default:false)Force a Robot to accept a file type it would have ignored.
By default, Robots ignore files they are not familiar with. 🤖/video/encode, for example, will happily ignore input images.
With the
force_acceptparameter set totrue, you can force Robots to accept all files thrown at them. This will typically lead to errors and should only be used for debugging or combatting edge cases.ignore_errorsboolean | Array<meta | execute>(default:[])Ignore errors during specific phases of processing.
Setting this to
["meta"]will cause the Robot to ignore errors during metadata extraction.Setting this to
["execute"]will cause the Robot to ignore errors during the main execution phase.Setting this to
trueis equivalent to["meta", "execute"]and will ignore errors in both phases.usestring | Array<string> | Array<object> | objectSpecifies which Step(s) to use as input.
- You can pick any names for Steps except
":original"(reserved for user uploads handled by Transloadit) - You can provide several Steps as input with arrays:
{ "use": [ ":original", "encoded", "resized" ] } - You can also tag input Steps with
asto pass semantic intent to robots:{ "use": [ { "name": ":original", "as": "image" }, { "name": ":original", "as": "mask" } ] }
TipThat's likely all you need to know about
use, but you can view Advanced use cases.- You can pick any names for Steps except
formatavif | gif | jpeg | jpg | png | webp(default:"png")The output format for the generated thumbnail image. If a short video clip is generated using the
clipstrategy, its format is defined byclip_format.qualitystring | numberCompression quality for still previews, from 1 to 100. When specified, the final image resize encodes directly into the requested format at this quality and strips embedded metadata. Omit it to retain the default encoding behavior. Animated clips use their own encoding settings. If
optimizeis enabled, optimization runs after this encoding.widthnumber(default:300)Width of the thumbnail, in pixels.
heightnumber(default:200)Height of the thumbnail, in pixels.
resize_strategycrop | fit | fillcrop | min_fit | pad | stretch(default:"pad")To achieve the desired dimensions of the preview thumbnail, the Robot might have to resize the generated image. This happens, for example, when the dimensions of a frame extracted from a video do not match the chosen
widthandheightparameters.See the list of available resize strategies for more details.
backgroundstring(default:"#ffffffff")The hexadecimal code of the color used to fill the background (only used for the pad resize strategy). The format is
#rrggbb[aa](red, green, blue, alpha). Use#00000000for a transparent padding.zoomboolean(default:true)If set to
false, smaller images will not be stretched to the desiredwidthandheight. This is useful if you want to retain the original image dimensions and only limit the output to a maximum size. For details about the impact of zooming for your preferred resize strategy, see the list of available resize strategies.Note that this parameter only affects strategies that produce a still image. Animated clips generated by the
clipstrategy are not affected.strategyobjectDefinition of the thumbnail generation process per file category. Each key selects a file category and its value is an ordered array of strategies:
File category Available strategies audioartwork,waveform,iconvideoartwork,frame,clip,iconimageimage,embedded-preview,icondocumentpage,iconarchiveiconwebpagerender,iconunknowniconartworkextracts embedded artwork,waveformdraws an audio waveform,frameextracts a video frame, andclipcreates an animated video preview. For images,imageresizes the original andembedded-previewextracts an embedded preview when available.pagerenders the first document page,rendercaptures a webpage, andicongenerates a file-type icon.For each file, the Robot will attempt to use the first strategy to generate the thumbnail. If this process fails (e.g., because no artwork is available in a video file), the next strategy is attempted. This is repeated until either a thumbnail is generated or the list is exhausted. Selecting the
iconstrategy as the last entry provides a fallback mechanism to ensure that an appropriate strategy is always available.The parameter defaults to the following definition:
{ "archive": [ "icon" ], "audio": [ "artwork", "waveform", "icon" ], "document": [ "page", "icon" ], "image": [ "image", "embedded-preview", "icon" ], "unknown": [ "icon" ], "video": [ "artwork", "frame", "icon" ], "webpage": [ "render", "icon" ] }artwork_outer_colorstringThe color used in the outer parts of the artwork's gradient.
artwork_center_colorstringThe color used in the center of the artwork's gradient.
waveform_center_colorstring(default:"#000000ff")The color used in the center of the waveform's gradient. The format is
#rrggbb[aa](red, green, blue, alpha). Only used if thewaveformstrategy for audio files is applied.waveform_outer_colorstring(default:"#000000ff")The color used in the outer parts of the waveform's gradient. The format is
#rrggbb[aa](red, green, blue, alpha). Only used if thewaveformstrategy for audio files is applied.waveform_heightstring | number(default:100)Height of the waveform, in pixels. Only used if the
waveformstrategy for audio files is applied. It can be utilized to ensure that the waveform only takes up a section of the preview thumbnail.waveform_widthstring | number(default:300)Width of the waveform, in pixels. Only used if the
waveformstrategy for audio files is applied. It can be utilized to ensure that the waveform only takes up a section of the preview thumbnail.icon_stylesquare | with-text(default:"with-text")The style of the icon generated if the
iconstrategy is applied. The default style,with-text, includes an icon showing the file type and a text box below it, whose content can be controlled by theicon_text_contentparameter and defaults to the file extension (e.g. MP4, JPEG). Thesquarestyle only includes a square variant of the icon showing the file type. Below are exemplary previews generated for a text file utilizing the different styles:
with-textstyle:
squarestyle:

icon_text_colorstring(default:"#a2a2a2")The color of the text used in the icon. The format is
#rrggbb[aa]. Only used if theiconstrategy is applied.icon_text_fontstring(default:"Roboto")The font family of the text used in the icon. Only used if the
iconstrategy is applied. Here is a list of all supported fonts.icon_text_contentextension | none(default:"extension")The content of the text box in generated icons. Only used if the
icon_styleparameter is set towith-text. The default value,extension, adds the file extension (e.g. MP4, JPEG) to the icon. The valuenoneleaves the text box empty while reserving space for a custom text overlay, for example using HTML in your application.optimizeboolean(default:true)Specifies whether the generated preview image should be optimized to reduce its file size while maintaining visual quality. If enabled, the image will be optimized using 🤖/image/optimize.
optimize_prioritycompression-ratio | conversion-speed(default:"conversion-speed")Specifies whether conversion speed or compression ratio is prioritized when optimizing images. Only used if
optimizeis enabled. Please see the 🤖/image/optimize documentation for more details.optimize_progressiveboolean(default:false)Specifies whether images should be interlaced, which makes the result image load progressively in browsers. Only used if
optimizeis enabled. Please see the 🤖/image/optimize documentation for more details.clip_formatapng | avif | gif | webp(default:"webp")The animated image format for the generated video clip. Only used if the
clipstrategy for video files is applied.Please consult the MDN Web Docs for detailed information about the image formats and their characteristics. GIF enjoys broad support in software, but only supports a limited color palette. APNG supports a variety of color depths, but its lossless compression produces large images for videos. AVIF offers efficient compression, but animation support varies between browsers. WebP offers a balance between small file sizes and visual quality and is the default clip format.
clip_offsetstring | number(default:1)The start position in seconds of where the clip is cut. Only used if the
clipstrategy for video files is applied. For large videos, only portions of the file may be imported to improve speed. An offset outside the available media data can prevent clip generation.clip_durationstring | number(default:5)The duration in seconds of the generated video clip. Only used if the
clipstrategy for video files is applied. Be aware that a longer clip duration also results in a larger file size, which might be undesirable for previews.clip_frameratestring | number(default:5)The framerate of the generated video clip. Only used if the
clipstrategy for video files is applied. Be aware that a higher framerate appears smoother but also results in a larger file size, which might be undesirable for previews.clip_loopboolean(default:true)Specifies whether the generated animated image should loop forever (
true) or stop after playing the animation once (false). Only used if theclipstrategy for video files is applied.