Before generating a thumbnail, Thumbgen makes aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/sanskarsharma/thumbgen/llms.txt
Use this file to discover all available pages before exploring further.
GET request to the download_url provided in the API call and inspects the Content-Type response header to determine how the file should be processed. If the detected type matches an entry in the supported images list, the file is decoded and resized using the imaging library. If it matches an entry in the supported videos list, a single frame is extracted with ffmpeg. If neither list matches, the request is rejected.
Default Supported Types
- Images
- Videos
| MIME Type | Format |
|---|---|
image/jpeg | JPEG |
image/png | PNG |
image/gif | GIF |
image/bmp | BMP |
image/svg+xml | SVG |
image/tiff | TIFF |
If the Check that the origin server sets an accurate
Content-Type header returned by the download URL does not match any entry in either the image or video list, Thumbgen returns HTTP 422 with the response body:Content-Type header and that the MIME type is included in the active supported list.Customising Supported Types
Both the image and video MIME type lists can be fully replaced at runtime via environment variables, without any code changes or rebuilds. SetSUPPORTED_IMAGE_CONTENT_TYPES to a JSON array of MIME strings to override the image list:
SUPPORTED_VIDEO_CONTENT_TYPES to a JSON array of MIME strings to override the video list:
How Type Detection Works
- Thumbgen receives a
POST /thumbifyrequest containing adownload_url. - It issues a
GETrequest to that URL and reads theContent-Typeheader from the HTTP response. - The raw header value (e.g.
image/jpegorvideo/mp4) is compared against the active image list first, then the active video list. - On a match in the image list, the response body is streamed to a temporary file and passed to the
imaginglibrary for resizing. - On a match in the video list, the
download_urlis passed directly toffmpeg, which fetches and decodes the video itself to extract a single frame. - If neither list matches, Thumbgen returns HTTP 422 immediately without downloading the file further.