Can anyone recommend Windows software to automatically trim the edges of photographs of documents?

Must have an option to adjust for perspective.

The program does not need to take the actual photos.

Android apps that have this functionality include camscanner and Office Lens.

  • 1
    Would you consider yours a duplicate of this question? Perhaps it won't be if you list perspective modification as a requirement as well
    – Tymric
    Commented Oct 15, 2015 at 10:37
  • @Timmy Great question. I've adjusted per your recommendation. The other difference is the gratis requirement. Commented Oct 15, 2015 at 11:53

2 Answers 2


The freely available all-purpose image manipulation tool, ImageMagick, is capable of performing automatic deskewing and trimming of image files.

This tool can be invoked from a batch file to automatically deskew and crop every image in the current directory as follows:

for /r %%i in (*.png)  do convert %%i -set filename:f "%t" -background
white -fuzz 50% -deskew 40% -trim +repage %[filename:f]_cropped.png

Note: there may be an error here as I am converting a Bash-script from a Linux system. Please edit my answer if you test this out.

Play with -fuzz to adjust aggressiveness of cropping and -deskew to adjust skew detection will allow you to have more control over your output.

If you want some more advanced ideas, check out "Adaptive background after rotation / deskew" and Fred's Unrotate Script.


I use Batch Image Resizer. It can batch-process hundreds of images quickly. It has autocrop action where it can automatically remove uniform or semi-uniform "background" from the sides you specify.

You can play around with tolerance to achieve optimal results. Here's the screenshot of that (all 4 sides are selected):


It is a commercial product though it's not very expensive and they frequently have sales.

Disclaimer: I have purchased this product sometime ago and am its paid user.


Sorry did not pay attention to "gratis" tag at first. In that case I would also say ImageMagick, though it is certainly not as straight forward to use as the software I mentioned.

  • 1
    you might want to "move" your answer to this question here.
    – baitisj
    Commented Oct 19, 2015 at 17:33
  • Thanks for the tip. Though not sure if I can actually move it. I suppose I will attempt to answer it :)
    – Fit Dev
    Commented Oct 19, 2015 at 18:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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