ForHosting KIT · Images

Resize an image

Sometimes the job is exactly one image and exactly one target size — a thumbnail for a listing, a banner for an email, an avatar for a profile. This endpoint does that single job well, without forcing you to think in batches or presets you don't need.

● StablePer request + per image$0.002
Use it from WebAPIEmailApp soonTelegram soon

Run this on our servers with your account. Free tools run in your browser; this one bills your KIT balance per the price above.

The everyday problem behind resizing

An image rarely arrives in the dimensions you actually need. A product photo comes back from a supplier at 4000x3000, a designer hands over a banner at print resolution, a user uploads a profile picture that's twelve megapixels — and every one of those has to shrink, and sometimes grow, to fit a specific slot in a page or a template. Doing that resize correctly, without stretching, distorting, or leaving ugly artifacts, is a small technical task that becomes tedious the moment it has to happen dozens of times a day inside an application.

What you send and what comes back

You submit an image, by URL or upload, along with the target width and height and how you want the fit handled — cropped to fill the exact box, contained within it while preserving proportions, or stretched exactly to the dimensions given. The task resizes using a quality-preserving algorithm rather than naive pixel dropping, and returns a single resized file in the output format you request, keeping the original's orientation and color profile intact unless you tell it otherwise.

Why proportion and interpolation actually matter

Resizing sounds trivial but it's a decades-old problem in computer graphics: shrink an image carelessly and you get moiré patterns and jagged edges, enlarge it carelessly and you get blur or blockiness. The interpolation method used to compute new pixel values from old ones is what separates a resize that looks intentional from one that looks like it was done in a rush, and it's exactly the part most developers don't want to implement themselves.

Fitting into an automated pipeline

Because the endpoint is asynchronous, it slots naturally into an upload-and-process pipeline: a user uploads an image, your system fires the resize call, and a signed webhook delivers the finished file the moment it's ready, with no polling loop to maintain. It pairs well with a storage step that immediately archives the resized output, or with a moderation step that runs before or after, depending on how your pipeline is ordered.

When one resize call is the right tool

If you need several sizes from the same source image, our batch and responsive-set endpoints are built for that. This endpoint is deliberately narrow: one image in, one image out, at one exact size, which makes it the fastest and cheapest way to solve the single-image case without paying for capability you won't use.

Profile picture normalization

A social or SaaS app resizes every uploaded avatar to a fixed square dimension the instant it's uploaded, before it ever touches a user's feed.

Marketplace listing photos

A marketplace resizes supplier-submitted product photos to the exact card dimensions used on listing pages, keeping every product tile visually consistent.

Email banner preparation

A marketing automation tool resizes a campaign's hero image to the fixed width required by email clients right before a send goes out.

CMS featured image pipeline

A headless CMS resizes an editor's uploaded featured image to the theme's required dimensions as part of the publish workflow.

How do I resize an image through the api?

Send a POST to /image/resize with the source image (URL or upload) and your target width and height; you get a task_id back and the resized file arrives via webhook or a signed link.

Can I resize by cropping to fill instead of just stretching?

Yes, you choose the fit mode: fill and crop to the exact box, contain within it preserving proportions, or stretch to the given dimensions.

What image formats are supported?

Common raster formats are accepted on input, and you choose the output format, so you can also use this endpoint to convert format and resize in a single call.

Is there a free tier for the image resize api?

There's no free tier — free tiers get abused and slow everyone down. Access runs on a prepaid ForHosting KIT balance: top up from $10.00 (it never expires) and each request is charged at its published price, so a call with no balance returns HTTP 402. No subscription, no tokens, no invented credits, and a failed task is never charged.

How much does it cost to resize one image?

$0.002 per request plus $0.005 per image, billed only on tasks that actually complete.

What if the resize fails or the image is invalid?

The task retries automatically up to three times; if it still can't complete, you receive a clear error and are never charged for the failed attempt.

How do I resize a large batch of images instead of one at a time?

Use the dedicated batch resize endpoint, which is built specifically for processing many images in a single call rather than looping this one.

How long is the result available after processing?

The signed link stays valid for 24 hours, and we recommend the webhook for production use so you never have to poll for the result.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/image/resize

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, and soon from our app, email and Telegram.

curl -X POST https://api.kit.forhosting.com/image/resize \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"image":"https://ejemplo.com/imagen.jpg"}'
{
  "image": "https://ejemplo.com/imagen.jpg"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "image.resize",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002
Per image$0.005

Published price — no tokens, no invented credits. A failed task is never charged.

max_mb15
max_megapixels12
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Read the full KIT documentation →