A nice self-contained first contribution: add a solarize filter — the photographic Sabattier effect, where channel values above a threshold are inverted.
Spec
- Name:
solarize
- Usage:
solarize[=threshold], threshold 0–255 (default 128)
- For each R/G/B channel
c: if c >= threshold, set c = 255 - c; else leave it. Alpha untouched.
- Write
f_solarize. Copy f_invert (~line 249) as a template — same shape, just add the threshold check. Read the arg with argd(a, n, 0, 128.0) (see f_brightness, ~line 264). clampb() clamps to 0–255.
- Register it in the
FILTERS[] table (the "colour" block, ~line 578):
{"solarize", "solarize[=T] invert channels >= T (default 128)", f_solarize},
- Document it: add
solarize to the README Filters → Colour list (README.md). Per CONTRIBUTING.md ("Adding or changing a filter", step 5), a new filter must be listed there.
Done when
make builds clean (-Wall -Wextra, no warnings)
imgcli -filters lists solarize
solarize appears in the README Colour filter list
imgcli -y -i testsrc=128x128 -vf "solarize" out.png works; solarize=64 changes the result
- (bonus) a line in the
check target of the Makefile exercising it
Small, visual, and a real feature. Difficulty: easy — happy to give pointers.
A nice self-contained first contribution: add a
solarizefilter — the photographic Sabattier effect, where channel values above a threshold are inverted.Spec
solarizesolarize[=threshold], threshold 0–255 (default 128)c: ifc >= threshold, setc = 255 - c; else leave it. Alpha untouched.Where — mostly in
src/filters.cf_solarize. Copyf_invert(~line 249) as a template — same shape, just add the threshold check. Read the arg withargd(a, n, 0, 128.0)(seef_brightness, ~line 264).clampb()clamps to 0–255.FILTERS[]table (the "colour" block, ~line 578):{"solarize", "solarize[=T] invert channels >= T (default 128)", f_solarize},solarizeto the README Filters → Colour list (README.md). Per CONTRIBUTING.md ("Adding or changing a filter", step 5), a new filter must be listed there.Done when
makebuilds clean (-Wall -Wextra, no warnings)imgcli -filterslistssolarizesolarizeappears in the README Colour filter listimgcli -y -i testsrc=128x128 -vf "solarize" out.pngworks;solarize=64changes the resultchecktarget of theMakefileexercising itSmall, visual, and a real feature. Difficulty: easy — happy to give pointers.