This Repo packages up the work from Mark Zucker into a python module and cli script
Convert scans of handwritten notes to beautiful, compact PDFs see full writeup
Note this package does not convert to PDF as the original module relies on ImageMagick, this is very easy to implement yourself.
These examples use the default settings in the Python module.
Original | NoteShrunk |
---|---|
Size: 1.4MB![]() |
Size: 516KB![]() |
Size: 73KB![]() |
Size: 51KB![]() |
Size: 132KB![]() |
Size: 109KB![]() |
- Python 2 or 3
- NumPy 1.10 or later
- SciPy
- Image module from PIL or Pillow
Ensure you have Numpy, SciPy and PIL installed:
pip install numpy scipy pillow
pip install NoteShrinker
Docker
docker run -v $PWD/Examples/Input:/imgs challisa/noteshrinker /imgs/us_tax_form_1937.jpg -w
Command line
note-shrinker IMAGE1 [IMAGE2 ...]
Integrating into your Python scripts
from NoteShrinker import NoteShrinker
# Create a NoteShrink object full of images, either an array of filepaths, PIL images or numpy arrays
ns = NoteShrinker(['test.png'], **args)
# Shrink the images by calling the shrink method, this returns an array of PIL images encoded as RGB
shrunk = ns.shrink()
# Carry on with your image processing....
for img in shrunk:
img.save('example.png')