MediaTofuImage API for resize, convert, and more
Image API for resize, convert, and more
POST /v1/tools/image/<name> to resize, crop, convert, compress, read info, remove the background, or transform an image (rotate, flip, blur, sharpen, colour changes). Images may be up to 20 MB and 100 megapixels. Unreadable images are not charged. Short jobs can return their result in the same request with ?wait=25.
Example
curl "https://api.mediatofu.com/v1/tools/image/resize?wait=25" \
-H "Authorization: Bearer $MEDIATOFU_KEY" \
-H "Content-Type: application/json" \
-d '{ "input": "https://example.com/photo.jpg", "width": 800, "format": "webp" }'With ?wait=25 a short job can return its result in the same request. Short jobs typically take about 5–15 seconds including container start. Leave wait off and poll GET /v1/jobs/:id, or pass webhook_url on a paid plan.
Tools
info, resize, crop, convert, compress, remove-background, and transform. Formats include WebP, AVIF, JPEG, PNG, and GIF. Transform can combine resize with rotate, flip, blur, sharpen, brightness, contrast, saturation, gamma, background colour, and remove_background.
Billing
Image jobs share video compute. Standard image work is 3 compute seconds (info is 1; background removal is 12). At Pay-per-use that is about $1.20 per 1,000 standard images or $4.80 per 1,000 removals. Included monthly compute covers about 100 / 12,000 / 30,000 standard images on Free / Starter / Pro.
Plans
Free: $0, 5 minutes of compute a month, jobs up to 1 minute, inputs up to 50 MB, 1 job at a time. Pay per use: $0.024 per compute minute, billed by the second, no monthly fee. Jobs up to 5 minutes, inputs up to 2 GB, 3 jobs at once. Starter: $9/month includes 600 minutes, then $0.015 a minute. Jobs up to 5 minutes, inputs up to 2 GB. Pro: $19/month includes 1,500 minutes, then $0.0127 a minute. Jobs up to 10 minutes, inputs up to 2 GB.
Questions
How are image jobs billed?
Image tools share the same compute meter as video. A standard image job counts as 3 compute seconds (info is 1; background removal is 12). An image that cannot be read is not charged. At Pay-per-use rates that is about $1.20 per 1,000 standard images or $4.80 per 1,000 background removals; Starter overage is about $0.75 / $3.00 per 1,000; Pro overage is about $0.64 / $2.54 per 1,000. Included compute covers about 100 / 12,000 / 30,000 standard images a month on Free / Starter / Pro (or 25 / 3,000 / 7,500 removals).
How do I get the result?
Add ?wait=25 and a short job can return its result in the same request. Short jobs typically take about 5–15 seconds including container start. 25 seconds is the longest wait. Otherwise you get a job id to check with GET /v1/jobs/:id, or on a paid plan you can pass webhook_url and we POST the result to you.
Do failed jobs cost anything?
A failure on our side is never charged, and neither is an input we couldn't download, one over your plan's size limit, or an image that could not be read. If your command runs and FFmpeg exits with an error, or the job reaches your plan's length limit, the seconds it used count. Nothing retries automatically.
What does MediaTofu cost?
Free: $0, 5 minutes of compute a month, jobs up to 1 minute, inputs up to 50 MB, 1 job at a time. Pay per use: $0.024 per compute minute, billed by the second, no monthly fee. Jobs up to 5 minutes, inputs up to 2 GB, 3 jobs at once. Starter: $9/month includes 600 minutes, then $0.015 a minute. Jobs up to 5 minutes, inputs up to 2 GB. Pro: $19/month includes 1,500 minutes, then $0.0127 a minute. Jobs up to 10 minutes, inputs up to 2 GB.