Image Resize API
Convert png, jpg, jpeg, webp, avif, tiff, gif, bmp, svg files to png, jpg, jpeg, webp, avif with a single POST request. Upload a file as multipart/form-data and the API returns a download URL for the converted file.
Input
png, jpg, jpeg, webp, avif, tiff, gif, bmp, svg
Output
png, jpg, jpeg, webp, avif (image/png)
Credit cost
1 per file
Max file size
Per plan (10–500 MB)
Endpoint
https://api.fileswitch.co/api/v1/converter/image-resizeAuthentication is optional for guests and recommended for production. Send either an API key or a JWT access token as a Bearer token. Authenticated requests deduct 1 credit from your balance; failed conversions are refunded. See Authentication for details.
Quick start
The same request in every supported language. Each example uploads a file and prints the downloadUrl from the response.
curl -X POST https://api.fileswitch.co/api/v1/converter/image-resize \
-H "Authorization: Bearer fc_YOUR_API_KEY" \
-F "file=@input.png" \
-F "width=0" \
-F "height=0" \
-F "fit=inside" \
-F "position=centre" \
-F "background=transparent" \
-F "withoutEnlargement=true" \
-F "kernel=lanczos3" \
-F "outputFormat=auto" \
-F "quality=80" \
-F "stripMetadata=true"Parameters
Send file plus any optional options. Every option is optional and falls back to its default when omitted.
| Field | Type | Default | Description |
|---|---|---|---|
| file | binary | — | The file to convert. Accepts .png , .jpg , .jpeg , .webp , .avif , .tiff , .gif , .bmp , .svg |
| width | number | 0 | Target width in pixels; 0 keeps the original width. Range: 0 .. 20000 |
| height | number | 0 | Target height in pixels; 0 keeps the original height. Range: 0 .. 20000 |
| fit | string | inside | How the image fits the target box. Values: cover, contain, fill, inside, outside |
| position | string | centre | Anchor position when cropping to fit. Values: centre, top, right top, right, right bottom, bottom, left bottom, left, left top |
| background | string | transparent | Fill color for contain/outside fit. |
| withoutEnlargement | boolean | true | Never upscale images beyond their original size. |
| kernel | string | lanczos3 | Resampling kernel. Values: lanczos3, lanczos2, cubic, mitchell, nearest |
| outputFormat | string | auto | Output format; auto keeps the source format. Values: auto, png, jpeg, webp, avif |
| quality | number | 80 | Output quality for lossy formats. Range: 1 .. 100 |
| stripMetadata | boolean | true | Remove EXIF/ICC metadata. |
{
"file": "input.png",
"width": 0,
"height": 0,
"fit": "inside",
"position": "centre",
"background": "transparent",
"withoutEnlargement": true,
"kernel": "lanczos3",
"outputFormat": "auto",
"quality": 80,
"stripMetadata": true
}Response
Every conversion endpoint returns the same success / message / data envelope. The data object is a Conversion record with a temporary downloadUrl.
{
"success": true,
"message": "Conversion completed",
"data": {
"id": "b10a5f2e-8c1e-4b3a-9c1d-2e3f4a5b6c7d",
"inputFormat": "html",
"outputFormat": "pdf",
"inputFileName": "document.html",
"outputFileName": "document.pdf",
"inputFileSize": 45210,
"outputFileSize": 88431,
"status": "completed",
"error": null,
"creditCost": 2,
"downloadUrl": "/api/v1/converter/download/conversions%2Fb10a5f2e-8c1e-4b3a-9c1d-2e3f4a5b6c7d%2Foutput.pdf",
"createdAt": "2026-07-31T13:00:00.000Z",
"completedAt": "2026-07-31T13:00:02.000Z"
}
}Prepend https://api.fileswitch.co/api/v1 to the downloadUrl and download with the same credentials. Files are retained temporarily and auto-deleted. See the full field reference in Response Schema.
Related conversions
Image Compress
png, jpg, jpeg, webp, avif, tiff, gif, bmp, svg png, jpg, jpeg, webp, avif
Image Crop
png, jpg, jpeg, webp, avif, tiff, gif, bmp, svg png, jpg, jpeg, webp, avif
Image Thumbnail
png, jpg, jpeg, webp, avif, tiff, gif, bmp, svg png, jpg, jpeg, webp, avif
Image Rotate
png, jpg, jpeg, webp, avif, tiff, gif, bmp, svg png, jpg, jpeg, webp, avif
Ready to convert png, jpg, jpeg, webp, avif, tiff, gif, bmp, svg → png, jpg, jpeg, webp, avif? Start free — no credit card required.