ForHosting KIT · Images

Round image corners

Rounded image corners look simple, but a radius becomes geometrically invalid when it is larger than half the image’s shortest side.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

This calculator checks the width, height, and proposed radius before an image pipeline applies the effect. A valid request returns the maximum permitted radius and a clear description of the rounded-rectangle alpha mask. An invalid request fails immediately, helping design tools, export scripts, and content systems reject impossible settings before rendering begins.

Validate the radius before processing an image

Enter the image width and height as positive whole pixels, then provide the desired corner radius in pixels. The validator finds the shortest side and divides it by two to establish the largest radius that can fit without opposite corner arcs crossing. For a 1200 by 800 image, for example, the shortest side is 800 pixels and the maximum valid radius is 400 pixels. A radius from zero through 400 is accepted, including fractional values when a layout or rendering engine supports subpixel geometry. Anything larger is rejected with an input error that states the calculated limit. This check is useful before calling an image transformer because it separates a cheap geometry decision from file decoding, upload, or rendering work. It also gives browser forms and APIs one consistent rule, preventing one client from silently clamping a value while another fails. Width and height must be positive integers because they represent the actual raster dimensions, while the radius must be a finite, non-negative number.

Understand the rounded-rectangle mask

A successful result describes an alpha mask with the same width and height as the source image. The central area remains opaque. At each corner, a quarter-circle arc with the requested radius defines the boundary: pixels inside the rounded rectangle remain visible, while pixels outside those four arcs become transparent when the mask is applied. The capability describes that operation but does not upload, decode, or modify an image file. A radius of zero produces an ordinary opaque rectangle, so no corner pixels are removed. At the maximum radius, the arcs meet along the shortest dimension; a square image therefore becomes a circle, while a rectangular image becomes a capsule-like rounded rectangle. The response repeats the accepted dimensions, the radius, and the computed maximum radius alongside the human-readable mask description. This makes the output suitable for logs, validation messages, design specifications, and downstream code that needs to explain what will happen before it invokes a renderer. No interpolation method is assumed because antialiasing belongs to the image engine that eventually applies the mask.

Use one geometry rule across design and automation

Consistent radius validation prevents subtle differences between mockups, websites, mobile apps, and batch image jobs. A design system can check avatar and card specifications before publishing tokens. A media service can reject an invalid transformation request before allocating image-processing resources. A storefront can verify that user-selected rounding will work for every generated thumbnail size. Because this capability performs only deterministic arithmetic and string construction, identical inputs always return identical results; it uses no network request, random value, clock, storage, or hidden image operation. The calculation preserves the source canvas dimensions because rounding corners changes visibility at the edges rather than resizing the canvas itself. The maximum radius is based only on the shortest side, so rotating the dimensions or exchanging width and height does not change the allowed limit. The API price is $0.002 per request, and the same pure calculation is suitable for a free browser runner. Use the returned description as a plan or validation record, then pass the validated radius to the separate image renderer that performs the actual pixel transformation.

Check avatar geometry

Confirm that a profile image radius is valid and determine whether a square avatar will become fully circular.

Guard an image transformation API

Reject impossible corner settings before uploading, decoding, or rendering the source image.

Validate design tokens

Compare shared corner-radius values with each image size and keep web, mobile, and export behavior consistent.

What is the maximum allowed corner radius?

It is half of the shorter image dimension. For an 800 by 600 image, the maximum radius is 300 pixels.

What happens when the radius is too large?

The request fails with an invalid input error that includes the maximum radius calculated from the image dimensions.

Does this capability change the image file?

No. It validates dimensions and describes the alpha mask; a separate image renderer must apply that mask to the pixels.

Can the radius be zero or fractional?

Yes. Zero describes a rectangular mask with no removed corners, and any finite fractional radius within the limit is accepted.

Does rounding corners change the canvas dimensions?

No. The mask has the same width and height as the source; it only makes pixels outside the corner arcs transparent.

What does an API request cost?

Each API request costs $0.002. The deterministic calculation can also run in the browser without network access.

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/round-corners

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, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/image/round-corners \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"width":1200,"height":800,"radius":64}'
{
  "width": 1200,
  "height": 800,
  "radius": 64
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "image.round_corners",
  "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

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 →