Compress scanned handwritten notes with Noteshrink
You scan your handwritten notes, but the quality isn’t great and the file is way too large. The solution: Noteshrink.
This assumes your notes are already in .pdf format.
1. Install Noteshrink
It’s best to install it in a Python virtual environment:
pip install noteshrink
2. Configure ImageMagick (if needed)
On some systems, you may need to adjust ImageMagick’s security policy to allow PDF handling:
nano /etc/ImageMagick-6/policy.xml
Find the PDF line and change:
rights="none"
to:
rights="read|write"
It should look like this:
<policy domain="coder" rights="read|write" pattern="PDF" />
3. Convert the PDF to images
Convert each page into PNG files:
pdftoppm notes.pdf page -png
4. Improve the images
4.1. Increase contrast
find . -type f -name "*.png" | parallel convert {} -sigmoidal-contrast 10,200% {}
4.2. Reduce number of colors
find . -type f -name "*.png" | parallel convert {} -level 50%,50% {}
Note: In ImageMagick 7, convert is replaced by magick.
5. Compress with Noteshrink
Finally, compress everything and generate the optimized PDF:
noteshrink -w -g -O -C -Q -o notes-compressed.pdf *.png
6. Result
The resulting notes-compressed.pdf will be much smaller than the original because:
- It reduces the number of colors
- It fades or partially removes the background
- It improves the readability of handwritten content
With this process, you can turn heavy, low-quality scans into much lighter and cleaner documents.