Image sharpen kernel calculator
This image sharpen kernel calculator converts a single strength value into the exact 3x3 convolution matrix for Gaussian unsharp masking.
Run — free
It is useful when an image library, shader, canvas pipeline, or custom processor expects kernel coefficients rather than a friendly sharpening slider. The result is deterministic, normalized to preserve constant brightness, and ready to copy into code. Enter any finite strength from 0 through 5 to inspect the center, edge, and corner weights without uploading or processing an image.
From a sharpening control to concrete coefficients
A user interface often describes sharpening with one slider, but a convolution engine needs nine numbers arranged as a matrix. This calculator bridges those two representations. It starts with the normalized 3x3 Gaussian blur kernel whose rows are proportional to 1–2–1, then forms an unsharp mask by adding the original signal and subtracting a strength-scaled blurred signal. In compact notation, the sharpen kernel is (1 + strength)I − strength·G, where I is the identity kernel and G is the Gaussian kernel. The resulting matrix has equal corner coefficients, equal edge coefficients, and one larger center coefficient. At strength zero, the matrix is the identity and leaves every pixel unchanged. Increasing strength makes neighboring pixels contribute negatively while increasing the center contribution, which emphasizes local contrast around edges. The returned coefficient sum remains exactly one after stable rounding, so a perfectly uniform image region retains its overall level instead of becoming systematically lighter or darker.
How to interpret and apply the 3x3 matrix
The result lists the kernel as three arrays in row-major order. For each output pixel, align the matrix center with that pixel, multiply every coefficient by the corresponding pixel in the 3x3 neighborhood, and add the nine products. Apply the same operation independently to color channels unless the imaging system specifies a luminance-only workflow. Boundary handling is deliberately outside this estimate because convolution libraries offer different policies, such as clamping to the nearest edge pixel, reflecting the image, wrapping coordinates, or ignoring incomplete neighborhoods. Those policies can change the appearance near the frame but do not change the kernel itself. Some libraries flatten matrices into one list; in that case, concatenate the returned rows from top to bottom. Others use correlation instead of convolution, but this kernel is rotationally symmetric, so both orientations produce the same coefficients. The `coefficient_sum` field provides a quick normalization check, while `size` confirms the expected kernel dimension for programmatic consumers.
Choosing a useful strength and understanding the limit
Start with a modest strength and judge the result on representative images rather than on a single high-contrast crop. Sharpening increases local contrast, so it can make genuine detail appear clearer, but it can also amplify sensor noise, compression blocks, ringing, and halos. The supported interval is 0 through 5 inclusive. This explicit bound catches misplaced percentages and other accidental inputs before they produce extreme coefficients. A value of 1 means the original image is combined with one full-strength residual between the source and its Gaussian blur; fractional values give gentler correction, while larger values exaggerate the residual. The calculation does not inspect an image and therefore cannot recommend an aesthetically ideal setting. It estimates only the exact mathematical kernel corresponding to the requested parameter. For reproducible pipelines, record the strength together with boundary behavior, color space, channel policy, and any clipping or quantization performed after convolution. Those surrounding choices often explain visual differences between tools that use the same nominal sharpening strength.
What you can do with it
Configure an image-processing library
Convert a human-readable sharpening strength into the nine coefficients required by a generic convolution function.
Build a shader or canvas filter
Generate a normalized kernel for a GPU fragment shader, WebGL effect, or browser canvas processing pipeline.
Document a reproducible image workflow
Record the exact matrix behind a sharpening setting so another implementation can reproduce the same mathematical operation.
FAQ
What does the API request cost?
Each API request costs $0.002. The same deterministic calculation is available free in the browser.
What strength values are supported?
Strength must be a finite number from 0 through 5 inclusive. Values outside that range return an invalid input error.
What does a strength of zero return?
It returns the 3x3 identity kernel: the center coefficient is 1 and every neighboring coefficient is 0.
Why do the coefficients sum to one?
A unit sum preserves constant image regions, preventing the kernel from changing overall brightness where every neighboring pixel has the same value.
Does this tool sharpen my image?
No. It calculates the kernel only. Apply the returned matrix with an image library, convolution function, shader, or other processor.
Is this the same as every application's sharpen slider?
Not necessarily. Applications may use different blur radii, thresholds, color spaces, edge policies, or nonlinear processing. This result follows the documented 3x3 Gaussian unsharp-mask formula.
For developers — API 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.
API endpoint
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.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/image/sharpen-estimate \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"strength":1}'const res = await fetch("https://api.kit.forhosting.com/image/sharpen-estimate", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"strength": 1
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/image/sharpen-estimate",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"strength": 1
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/image/sharpen-estimate", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"strength":1}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"strength":1}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/image/sharpen-estimate", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"strength": 1
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "image.sharpen_estimate",
"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.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_mb | 15 |
max_megapixels | 12 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |