eg:
$image->dither([
'method' => 'floydsteinberg',
'colors' => ['#fff', '#000'],
]);
Leaving links to the two underlying libraries Kirby uses and which could be used for implementing this:
https://github.com/claviska/SimpleImage?tab=readme-ov-file#maxcolorsmax-dither
https://imagemagick.org/script/command-line-options.php#dither