0

I'm trying to do some batch processing of a couple thousand images that were scanned in with a business card scanner. Due to sloppiness in the scanning process, the images are all roughly the same dimensions (varying by a couple of pixels in width and height), but there are some that are "difficult".

My ultimate goal in processing these is:

  1. Every image should have exactly the same physical dimensions.
  2. The physical cards that were scanned have rounded corners, I'd like transparency in the scanned images here.
  3. Every image should fill the entire dimensions with little to no blank space around the edges.

Examples of difficult images:

  1. The card was already a light / off-white color to begin with, so distinguishing between the areas of the image that should be transparent and not is not always easy.
  2. The scanner thought the card was longer than it actually was (probably due to the auto-feed process), and so some images are a hundred or two hundred pixels taller, with a white band inserted at the bottom.

Originally I had it pretty close to working. I would magic wand the bottom left and top right pixels, then trim transparent pixels to cut out dead space, then scale all images to the exact same pixel dimensions.

I think I need to solve the white horizontal band at the bottom problem using something other than magic wanding, while still having it work with images that don't have a white band (since there are thousands of these).

One idea I had is something like a magic wand where you click the pixel you want to wand around, but where you specify the pixel color instead of having it take the color from the current location. But i'm not sure if something like this exists.

A second idea is that I can manually pull out all the images that have white bands by inspection, but then I need an automated process by which to crop out all of the white bands without affecting images that already have edges similar to white to begin with.

The third option which I'm dreading is to manually fix up all of the images with white bands.

2
  • 3
    I see no question to be answered here. – Scott Jan 1 at 6:06
  • You can probably use color range instead of magic wand: this will select a specific color, not pixel. Also it'd be much easier if you'd add several sample images instead of a wall of text – Sergey Kritskiy Jan 1 at 7:33

Your Answer

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

Browse other questions tagged or ask your own question.