Free plan

Resize

Change the size of a picture to the width and height you want
POST
/v1/images/resize
Resized
Original
Original 453 KBResized 12 KB

About this tool

This tool makes a picture bigger or smaller. Give a width, a height, or both. You choose how the picture fits: keep the whole picture, fill the space and cut the edges, add a border, or stretch it. A picture is not made larger than it is unless you allow it. You can also cut away plain borders first and choose the file type of the result.
For example, you make a large photo 800 wide so it loads quickly on your website, keeping its shape.

How to use it

  1. Choose this tool.
  2. Add one or more pictures with Upload or drag and drop.
  3. Type the width, the height, or both.
  4. Choose how the picture should fit into that size.
  5. Press Generate, then download the pictures.

What you get back

You get new pictures at the size you asked for. Every picture you added is resized the same way.
GOOD TO KNOW
Applies width/height/fit to every uploaded image. `enlarge` defaults to an inferred value, so images are not upscaled unless you ask for a larger size.
TEST IT LIVE

Try Resize in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
Images
Plan
Free
Method
POST
Endpoint
/v1/images/resize
Tool ID
images.resize
Authentication
API key
Accepts
JPEG, PNG, WEBP, GIF, AVIF, TIFF +15 more
Background jobs
Yes
Usage group
Image
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/images/resize" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'images=@photo.jpg' \
  -F 'width=800' \
  -F 'height=600' \
  -F 'resizeMode=fit'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.images.resize({
    "images": 'photo.jpg',
    "width": 800,
    "height": 600,
    "resizeMode": "fit"
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->images()->resize([
    'images' => 'photo.jpg',
    'width' => 800,
    'height' => 600,
    'resizeMode' => 'fit',
]);
echo $result->requestId;
FAQ

Frequently asked questions

Change the size of a picture to the width and height you want.

Resize accepts JPEG, PNG, WEBP, GIF, AVIF, TIFF, SVG, SVGZ, BMP, ICO, APNG, PNM and 9 more. You can send several files in one request.

Resize is included in every plan, including Free. Each run uses credits from your monthly allowance.

Send a POST request to /v1/images/resize with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.