TransWikia.com

Automatic & intelligent crop 1,000 images

Photography Asked on March 11, 2021

enter image description hereI have about 1,000 scanned / photographed images, each with different formats but all with rectangular/square shape, that need to be cropped to remove the background and the white space around the images.
The cropping needs to be done in an intelligent way, for example by identifying the background (wooden table / brown color range) and white space around each photo, preferably rotated to vertical/horizontal position (max few degrees) and crop to a rectangular format.

I’d expect that, in these days of artificial intelligence with software that recognizes faces, there is a software app to do that but after several hours searching I haven’t been able to find one.
I have read multiple articles on this forum and elsewhere on the web and tried multiple options, but none of them do a proper job:

  • Photoshop automatic crop and straighten function (in batch action) fixes less than 10% of the images and continuously needs manual intervention. It also creates multiple cropped artefact images with tiny cropped areas and cannot figure out which one to save;
  • GIMP cropping (as described by Francois Malan) only works to separate out images from one scanned page, not for cropping many single images;
  • Irfanview cannot intelligently find the borders so is useless;
  • ImageMagic (and many other apps) that I have tried do not have this automatic capability either.

All these programs, including Photoshop, are great if you want to crop using fixed positions and/or formats, but none of these seem to have the intelligence to find the white edges of an image and use that for cropping.
Cropping 1,000 images by hand (with Photoshop support) will take me probably about 30 hours work (2 minutes each including some deskewing).

Any suggestion? The key topics in stackexchange are several years old so perhaps there is a new app that can handle this without manual intervention. Given the potential time savings I don’t mind paying for software that does a proper job. Worst case I will re-photograph all images spending about 10-15 seconds extra per image to make sure they are lined up horizontally and do the cropping while taking the photo (or send them to someone in a low-wage country to do this for me :-)).
Cheers

2 Answers

Middle-of-the-road solution with Gimp, that crops and straightens the images, assuming all your pictures are numbered in some directory (IMG_2027.JPG, IMG_2028.JPG, as long as there is an identifiable number suffix, you can even have missing numbers).

  1. install the ofn-file-next script, and use Edit>Keyboard shortcuts to assign it to a key.
  2. File>Open the first picture
  3. Start the Perspective tool and set it to Direction: Corrective and Clipping: Clip
  4. Click on the image, and drag the four corner handles to the four corners of your image
  5. Strike [Enter](the image is clipped/straightened)
  6. Strike the File>Next shortcut: the image is saved, and the next image in sequence is opened
  7. Repeat from step 4

After a few images, you can be as fast a 10-15 seconds/image...

Answered by xenoid on March 11, 2021

I tested your scan using a Mac app, SnipTag. This app has 2 cropping engines: Both auto-cropped the image correctly but didn't rotate it to upright orientation. SnipTag (and its cousin, Snip) can batch crop scans i.e. you could submit dozens of scans at a time. Also, if you capture multiple photos per scan, they are cropped and saved individually. It helps if you scan in accordance with the guidelines included in the app.Scan cropped with the two engines, bottom right Both apps are free to try [Disclosure: I do customer service at AIL, developer of these apps.]

Answered by MacEater on March 11, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP