By the end of this guide you will have Thumbgen running on your local machine, fired off your firstDocumentation 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.
/thumbify request with a real image or video URL, and confirmed that a 200×200 PNG thumbnail has been uploaded to your chosen destination. The whole process takes less than 5 minutes.
Check prerequisites
Thumbgen requires Go 1.14 or later and ffmpeg (for video thumbnails). Verify both are available before continuing.You should see version output for each command. If either is missing:
- Go — download the installer from go.dev/dl.
- ffmpeg — install via your system package manager (e.g.
brew install ffmpegon macOS,apt install ffmpegon Debian/Ubuntu) or grab a static build from ffmpeg.org.
Prefer containers? You can skip the Go and ffmpeg installs and run Thumbgen with Docker instead — see the Deployment guide. The Docker image is based on Alpine Linux and bundles ffmpeg automatically.
Clone and start the service
Clone the repository and start the server with You should see output similar to:Thumbgen is now listening on port 4499.
go run:The
ENV=LOCAL prefix is important when running outside Docker. Thumbgen uses the ENV variable to decide which shell to invoke when running ffmpeg commands — bash for local development and ash (the Alpine shell) inside the Docker container. Without ENV=LOCAL, video thumbnail generation will fail on systems that do not have ash available.Generate a thumbnail
With the service running, send a POST request to
Thumbgen will:
/thumbify. You need to provide two fields:| Field | Type | Description |
|---|---|---|
download_url | string | Publicly accessible URL of the source image or video to thumbnail. |
upload_url | string | HTTP PUT-accessible URL where the finished 200×200 PNG will be sent. |
- Download
photo.jpgfrom the source URL. - Detect the
image/jpegcontent type and process it with theimaginglibrary. - Resize and crop the image to 200×200 pixels.
- PUT the resulting PNG to your
upload_url.
download_url at an .mp4 or any other supported video format and Thumbgen will use ffmpeg to extract and crop the first frame instead.Confirm the upload
If the request succeeds, Thumbgen returns an HTTP 200 with an empty body, and the 200×200 PNG thumbnail is now available at your
upload_url destination.Check your upload target to verify:- S3 / GCS bucket — browse to the object in the console or download it with the CLI.
- Custom endpoint — inspect your server logs or storage to confirm the PUT was received.
- 400 — malformed JSON or missing
download_url/upload_url; body contains a"message"field (or plain text for body-read failures). - 422 — the download URL returned a non-2xx status, or the content type is not supported; body contains
{"message": "..."}. - 500 — an internal failure such as a non-200 response from the upload target; body contains
{"error": "There was an internal server error"}. This response is generated by Thumbgen’srecoveryMiddleware, which catches panics from any route handler.
Try the Web UI
Prefer a point-and-click experience? Open http://localhost:4499 in your browser while the service is running. The built-in web frontend lets you paste a download URL and an upload URL directly into a form and trigger thumbnail generation without writing anycurl commands — ideal for a quick sanity check during development.
Next Steps
- Read the full API Reference for request/response schemas and all status codes.
- Learn about Deployment options including Docker, Docker Compose, and Cloudflare Containers.
- See the Configuration page to customise supported MIME types via environment variables.