Charlie Gibbs <cgib…@kltpzyxm.invalid> wrote:
> On 2026-11-16, Nuno Silva <nuno…@invalid.invalid> wrote:
>> Consider having a look at ImageMagick's convert with -lat, "local >> adaptive thresholding". Sadly, my notes don't go beyond saying it's >> better than just threshold... example command line: >> >> convert in.pnm -lat 100x700-15% out.pbm >> >> <https://usage.imagemagick.org/transform/#lat>
> > That sounds interesting! I'll give it a look.
If you're not just after a quick fix, I've had some success with this script which runs a sequence of ImageMagick filters including "-lat": http://www.fmwconcepts.com/imagemagick/textcleaner/index.php As shown by the examples, it can take quite a few goes to narrow down on the best arguments to use for a particular document. Its greyscale output can be converted to monochrome with an appropriate threshold (ImageMagick can do this too) if desired.
>> (unpaper might also be useful, depending on how the input documents >> are?:) >> >> <https://flameeyes.com/projects/unpaper>
Interesting, I might try that out. Another program that has some similar features is Scan Tailor. I've only used the original, but there's a maintained fork called Tcan Tailor Advanced here: https://scantailor.net/
-- __ __ #_ < |\| |< _#