transform your images for FREE
POST https://www.imgresize.dev/resize
{ "imageUrl": string, // URL of image to resize "width": number, // Width in pixels "height": number, // Height in pixels "outputFilename": string, // Optional: save to file "keepTransparency": boolean, // Optional: preserve transparency (default: false) "rotateImage": boolean // Optional: rotate 180 degrees (default: false) }
// Success { "success": true, "imageUrl": string // Base64 or file path } // Error { "success": false, "error": string }
fetch('https://www.imgresizer.dev/resize', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ imageUrl: 'https://example.com/image.jpg', width: 800, height: 600 }) }) .then(response => response.json()) .then(data => { if (data.success) { console.log(data.imageUrl); } });
By default, the API returns a base64 encoded image string that can be directly used in image tags or stored. To save the resized image to a file instead, include the outputFilename
parameter in your request.
The resize operation maintains aspect ratio using the 'contain' fit mode, which ensures the entire image is visible without distortion. Any empty space is filled with a white background.
When keepTransparency
is enabled, the output will be in PNG format to preserve transparency. Otherwise, images are converted to JPEG with a white background.
When rotateImage
is enabled, the image will be rotated 180 degrees before resizing. This can be combined with transparency and other options.
The API is currently limited to: