News for hackers. Stuff that matters.
Re:Ask HN: What was your last “ah-ha!” moment? by sandreas on Monday October 10, 2022 @04:28PM (#33156055)
I was trying to create PDF files from photos taken with a phone camera (aka docscanner) and tried to compress as good as possible, when I realized that PNG supports 1 bit mode, with a palette of only 2 entries...

Combined with adaptive thresholding (e.g. Sauvola) this resulted in extremely compressed but still readable images.

I wrote a little C# tool called shrivel for my requirements: https://github.com/sandreas/shrivel/blob/main/shrivel/Comman...

No release but it works like this:

  shrivel process ./images/input/ --filter=resize[1750,1750] --filter=adaptivethreshold --output-template="{inputDirectory}/processed/{name}.pdf" --merge-pdf="./small_merged.pdf"

There are no comments on this comment yet.