Image
Resize Image
Resize an image by width and/or height — give just one and the aspect ratio is preserved. Optionally re-encode to a different format at the same time.
Free to try — no key required 10 credits / callSynchronous
Overview
Upload an image and target dimensions; receive a public R2 URL for the resized version. On the free-try path.
POST
https://api.bytefuse.in/api/v1/image/resizeRequest
Content type multipart/form-data. Provide at least one of width / height:
filefilerequiredThe image to resize.
widthintoptionalTarget width in px. If only
width or height is given, the other is computed to preserve aspect ratio.heightintoptionalTarget height in px.
target_formatstringoptionalOptional output format —
png, jpg, jpeg, webp, avif, bmp, tiff, gif.Default: source formatqualityintoptional1–100, applies to JPEG/WebP/AVIF.Default:
85Bounds
At least one ofwidth/height is required (else 422). Computed dimensions must fall within 1–20000 px.Response
200 OK, application/json — same shape as Compress Image; meta.width/meta.height are the new dimensions:
200 OK
{
"success": true,
"url": "https://<r2-host>/image/20260704/<uuid>.jpg",
"meta": {
"width": 800,
"height": 450,
"original_dimensions": "1920x1080",
"output_size": 96000,
"format": "JPEG",
"processing_time_ms": 140
},
"credits_charged": 1
}url is a public R2 link (no expires_at). X-Credits-Charged mirrors credits_charged (0 anonymous).
Examples
# width only — height is computed to keep aspect ratio
curl -X POST https://api.bytefuse.in/api/v1/image/resize \
-H "X-API-Key: dt_live_your_key" \
-F "file=@photo.jpg" \
-F "width=800" \
-F "quality=85"Errors
422Neither
width nor height given, computed size outside 1–20000, an invalid image, or an unavailable format.402 / 429 / 503Insufficient credits (authenticated), rate limited, or capacity/config error.
500The image engine failed unexpectedly.
