1

I'm looking for a simple and free application which can automatically scan a document (in the form of a JPG or PNG), change the perspective to remove skew, and then crop it.

It would be nice if the application also was able to scan documents directly from the webcam, but this is not required.

On iPhones, this could easily be done with an app called Microsoft Office Lens, but it's only for iOS and not Mac. The "scan document" feature in Notes is also able do this, but again it only works w/ iOS.

1

You can do the job on just about any platform using python and opencv - python should already be installed on your mac.

A very nice write up on how to do this is available in the pyimagesearch blog here.

The linked example, which includes quite a bit of additional code & comments to show the intermediate steps, uses just 75 lines of python to:

  1. Load the image
  2. Edge detect
  3. Crop
  4. Perspective Transform
  5. Threshold the Image
  6. Show the image

You will need to add a couple of lines to generate a new filename & save the image.

  • Free, gratis & Open Source
  • Supports multiple image formats including jpeg & png
  • Can be adapted to work with the camera
  • Will work on Mac, Windows, Linux, iOS, Android, Raspberrian, etc.
2
  • Thanks for the suggestion, but I don't have any experience w/ programming in python and wouldn't know where to start. – htmlcat Sep 18 '20 at 4:10
  • @htmlcat If you are on OS-X you already have Python 2 installed & there are lots of guides to installing python 3 on OS-X - the article that I linked above has links to how to install everything else needed and walks you by the hand nicely. If you can use a text editor to create a plain text file then you can follow the tutorial. – Steve Barnes Sep 19 '20 at 4:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.