2

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

  • 1
    Google does what you describe in their PhotoScan app, but they haven't released anything that works with preexisting image files. – xiota Mar 23 at 15:46
  • 1
    Half the problem is that the photo isn't square or even flat in the shot. You're going to need something that can either 'smart perspective crop' or be taught to, in effect, under-scan to square them up. – Tetsujin Mar 23 at 18:50
  • 1
    This exemplifies the importance of not just the camera rig in using a camera-as-scanner, but the necessity of using an easel as well so that images are flat and in the same exact spot. – Hueco Mar 24 at 1:31
  • The PhotoScan approach is great. The app would be extremely useful if it had high pixel rate, proper correction, low distortion, and proper sharpening and contrast. Unfortunately, the present app has none of these and is only good for social media low resolution usage. I doubt if Google is interested to expand this smart app for more professional use... – Gert Mar 25 at 10:12
  • Point taken to create a proper setup. A little extra time spent during the initial scanning saves a ton of work in after processing. Luckily I have the option to redo these images and straighten/crop them immediately. In my naivety I assumed that any decent image software, and for sure Photoshop, would have a tool to fix it. I had too high hopes of AI capabilities... – Gert Mar 25 at 10:18
1

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...

  • 1
    For the straight pics you can use the crop tool. If you know the actual aspect ratio (3:2?), images can be batch-rescaled by a script in a following step, or you can pad the source images to the required aspect ratio (also by script) before you crop/straighten (slightly better quality). – xenoid Mar 25 at 10:39
  • You're right. Solution is indeed to do a basic crop first followed by the Perspective tool, thereby adding time. Due to my lack of a standard setup all images are unique. Key learning is a) apparently there is not a smart tool to do that and b) a proper setup is key.. – Gert Mar 25 at 10:41

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.