3 ms·
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 supp
by sandreas 4y ago
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/Commands/ProcessCommand.cs#L111 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"