Thicken or thin bright shapes in a video: dilation and erosion by API
dilation grows bright areas and erosion shrinks them, two allowlisted filters in Sume's video filter. When they help and how to check cheaply.

To make bright shapes in a video thicker, run the dilation filter; to make them thinner, run erosion. FFmpeg describes dilation as expanding bright areas and shrinking dark ones, and erosion as the opposite, replacing each pixel with the minimum in its neighbourhood. Both are on Sume's video filter allowlist, so you send them as a filtergraph and get a new MP4 back for $0.02, after a free check.
When would I want this?
The useful cases are narrow. White line art on a dark background can look thin after a downscale, and dilation fattens it. A thin bright scratch or speckle can be reduced with erosion, at the cost of shrinking everything else bright. Pairing either with edgedetect or sobel, which are also allowlisted, changes how heavy outlines look.
It is not a general sharpening or denoising tool. If your problem is grain, median is the better filter; if it is softness, unsharp or cas. Dilation and erosion change the shape of regions, so run them on a short test first.
How do I run and check one?
Put the filter name in the graph with no input or output labels. Send it to the free check endpoint, then to the encode endpoint with an idempotency key. Both filters take inline options only, which is why they are allowed; the compiler refuses anything that would read a file.
Because the effect is visual, the cheapest review is one frame. After the encode, extract a frame at a time where the shape matters and compare it to the same time in the source.
curl -s https://api.sume.com/v1/video-filter/check \
-H "Authorization: Bearer $SUME_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"video_url": "https://media.sume.com/artifacts/artf_EXAMPLE.mp4",
"filtergraph": "dilation"
}'Which one should I pick?
The table compares the two with the filters people usually mean instead.
| Goal | Filter | Effect (per FFmpeg docs) |
|---|---|---|
| Thicken bright shapes | dilation | Expands bright areas, shrinks dark areas |
| Thin bright shapes | erosion | Shrinks bright areas, expands dark areas |
| Remove speckle noise | median | Replaces each pixel with a neighbourhood median |
| Outline edges | edgedetect, sobel | Edge detection |
What are the limits?
The source must live on media.sume.com and be 300 seconds or shorter. Up to 32 filters and 2,048 characters fit in a graph. If a chain gets long, trim the clip first with the trim tool so you pay to filter only the seconds you keep.
Each encode produces a new MP4 and never overwrites the source, so you can keep the original, try dilation at one setting and erosion at another, and compare the results frame against frame. Failed encodes return a structured job error rather than a broken file, and the idempotency key means a retried request does not queue a second paid encode.
Sources
Related posts
More in Media tools
- Make the spoken caption word bigger or bolder: typography ranges
Sume's design.typography sets weight, spoken-word scale, size, safe width and outline width for burned-in captions. Here are the exact ranges and the 400s.
- Reduce green spill on a subject: despill in Sume video-filter
To remove a green cast from a person shot against a green backdrop, send despill=type=green:mix=0.6 to Sume's video-filter. One $0.02 job per clip.
- Swap the colours of a video by API: the swapuv chroma-swap look
swapuv exchanges a clip's U and V chroma channels and leaves brightness alone, a quick surreal colour look. How to run it in Sume's video filter.
- Turn a video into a line drawing: edgedetect in video-filter
Send edgedetect=low=0.08:high=0.3 to Sume's video-filter for an outline look on any hosted clip. Add negate for dark lines on white. One $0.02 job.
Written by Sume