Skip to content

Sharpening

Advanced sharpening tool with three methods: adaptive (smart edge-aware), unsharp mask (classic radius/amount), and high-pass (texture emphasis). Includes built-in noise reduction to prevent sharpening artifacts.

API Endpoint

POST /api/v1/tools/sharpening

Accepts multipart form data with an image file and a JSON settings field.

Parameters

ParameterTypeRequiredDefaultDescription
methodstringNo"adaptive"Sharpening algorithm: adaptive, unsharp-mask, high-pass
sigmanumberNo1.0Adaptive: Gaussian sigma (0.5 to 10)
m1numberNo1.0Adaptive: flat area sharpening (0 to 10)
m2numberNo3.0Adaptive: jagged area sharpening (0 to 20)
x1numberNo2.0Adaptive: flat/jagged threshold (0 to 10)
y2numberNo12Adaptive: maximum flat sharpening (0 to 50)
y3numberNo20Adaptive: maximum jagged sharpening (0 to 50)
amountnumberNo100Unsharp mask: sharpening amount (0 to 1000)
radiusnumberNo1.0Unsharp mask: blur radius in pixels (0.1 to 5)
thresholdnumberNo0Unsharp mask: minimum brightness difference to sharpen (0 to 255)
strengthnumberNo50High-pass: filter strength (0 to 100)
kernelSizenumberNo3High-pass: convolution kernel size (3 or 5)
denoisestringNo"off"Pre-sharpening noise reduction: off, light, medium, strong

Example Request

bash
curl -X POST http://localhost:1349/api/v1/tools/sharpening \
  -H "Authorization: Bearer si_your-api-key" \
  -F "[email protected]" \
  -F 'settings={"method": "adaptive", "sigma": 1.5}'

Unsharp mask with threshold to protect smooth areas:

bash
curl -X POST http://localhost:1349/api/v1/tools/sharpening \
  -H "Authorization: Bearer si_your-api-key" \
  -F "[email protected]" \
  -F 'settings={"method": "unsharp-mask", "amount": 150, "radius": 1.5, "threshold": 10}'

Example Response

json
{
  "jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/photo.jpg",
  "originalSize": 2450000,
  "processedSize": 2510000
}

Notes

  • Only parameters relevant to the chosen method are used. For example, amount, radius, and threshold are ignored when method is adaptive.
  • The adaptive method uses Sharp's built-in adaptive sharpening with configurable flat/jagged region behavior.
  • The denoise option applies noise reduction before sharpening to prevent amplification of noise/grain.
  • High-pass sharpening extracts fine detail by subtracting a blurred version from the original, then blending back.
  • Output format matches the input format. HEIC, RAW, PSD, and SVG inputs are automatically decoded before processing.