Sign inSign up

challisa/noteshrinker

By challisa

•Updated over 7 years ago

Convert scans of handwritten notes to beautiful, compact Images

Image
0

364

challisa/noteshrinker repository overview

⁠NoteShrinker

GitHub stars Docker build Travis build Package version License

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.

⁠Examples

These examples use the default settings in the Python module.

OriginalNoteShrunk
Size: 1.4MBOriginal example 1Size: 516KBNoteShunk example 1
Size: 73KBOriginal example 2Size: 51KBNoteShunk example 2
Size: 132KBOriginal example 3Size: 109KBNoteShunk example 3

⁠Requirements

  • Python 2 or 3
  • NumPy 1.10 or later
  • SciPy
  • Image module from PIL or Pillow

⁠Installation

Ensure you have Numpy, SciPy and PIL installed:

pip install numpy scipy pillow
pip install NoteShrinker

⁠Usage

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')

Tag summary

Content type

Image

Digest

Size

180 MB

Last updated

over 7 years ago

docker pull challisa/noteshrinker