How to Split Multiple Scanned Photos Fast

559

7

12

Introduction: How to Split Multiple Scanned Photos Fast

About: I'm just trying to unleash human's limitless possibilities. For now I'm struggling too much with myself, but hope still remains...

Lets say you found yourself in a situation where you are in desperate need to scan lots of old (analog) family photos. Like around 2000 of them. That's a lot of photos. Scanning them one-by-one is a very bad idea, because this will take forever. Most efficient method of scanning will be to use flatbed scanner and try to fit as many photos in the single scanner page as possible.

But then, you will have additional task of cutting out individual photos from this scanned pages. This can take huge amount of time if done by traditional methods – (MS Paint or Paint.NET) manually cutting single image... Then pressing save... Then selecting quality and waiting for preview... Then selecting save location and manually renaming each single file...

Now, initially I though that people should have already created automatic software solution for this problem. Well, yes and no. Yes, they did it. No, none of the solutions work adequately at all. It only works in ideal conditions and only for specific types of photos.

So far nobody had trained neural network to do this task (probably because its very niche task, companies that earn monies on scanning use automated mechanical solutions), you will have to use your own (very powerful ;) neural network to do it manually!

But how to cut corners and try to minimize time cost as much as possible? This instructable will tell you exactly this! At least one of the possible ways.

Supplies:

  • Flatbed scanner
  • IrfanView
  • X-Mouse Button Control
  • New File Auto Incrementer
  • Lots of patience!

Step 1: Scan All Your Photos

This is self-explanatory. A few tips. Just put as many of them inside your scanner as possible and scan. Use your scanner manufacturer's software to scan with scanner's buttons. Don't use "auto" mode, it will mess things up. Use max DPI and grey-scale setting for BW photos, color setting for colored photos. Save in PNG to not loose any quality on JPEG re-encoding step later. Be careful not to put photos too close to scanner's bottom side, it might be a dead zone and parts of your photos would not be saved.

Step 2: Get Necessary Programs

  1. IrfanView
  2. X-Mouse Button Control
  3. New File Auto Incrementer (source code, 32_bit)

IrfanView is by far, the best photo editing program that suits this task. It's very fast and convenient in terms of doing lots of repetitive operations, something that many "bigger" and "cooler" programs lack.

X-Mouse Button Control is cool scripting/mouse remapping program. You might even start to use it every day (for example, mapping Ctrl+C, Ctrl+V to mouse side buttons), but in this particular case it will help with instant saving of the image after selecting it's area with just a single mouse button click.

New File Auto Incrementer is a little, tiny modest program that I developed precisely for this task. Its very small, but fulfills very important and repetitive role. You can check source code yourself via the link (if you want, you can compile it yourself too, I attached x64 build here).

Step 3: Configure X-Mouse Button Control

  1. Create folder for the individual images
  2. Copy nfainc.exe into it
  3. Open first scanned sheet in the IrfanView
  4. Open X-Mouse Button Control Settings
  5. Add IrfanView profile
  6. Choose your preferred button (if your mouse don't have side buttons, use middle button or scroll up/down)
  7. Add "Simulated Keys", paste this inside field and save settings:
    {CTRL}{SHIFT}B{RETURN}

Step 4: Let the Cutting Begin!

  1. Launch nfainc.exe
  2. Select first image to be cut out (you can change rectangle thickness/color in Browsing/Editing settings)
  3. Don't use button for now, use File-->Save Selection As... choose your output folder (where you copied nfainc.exe) and JPEG (or other format that you fancy) quality settings.
  4. After you saved first image, you can just press your scripted mouse button to instantly save selected image

New File Auto Incrementer will scan folder every 0.5 seconds and if it finds any newly created/edited files it will rename it with x_ prefix, where x is your photo number. In this way you can rapidly save huge amounts of them with most annoying repetitive steps out of the way.

With some breaks included in time, I was able to cut out 1751 photos in just 5 hrs 15 min, which is about 10.8 s/photo on average.

Don't worry about rotating your photos or editing them for now. You can do that later much more effectively.

Step 5: Bonus: Rotate Images in Explorer With a Single Mouse Click

Open Explorer's image editing panel by pressing little arrow in top right corner of window.

Then add this macroses to X-Mouse Button Control. You might want to use Layer 2 for this to not mess up your usual mouse settings (you can switch layers with RMB press on program icon in taskbar).

Middle Button {LMB}{MSAVE:1}{ASET:36,93}{LMB}{LMB}{MREST:1}
Button 4      {LMB}{MSAVE:1}{ASET:36,93}{LMB}{MREST:1}
Button 5      {LMB}{MSAVE:1}{ASET:101,89}{LMB}{MREST:1}

Top one rotates image 180 deg, middle one turns anti-clockwise and bottom one turns it clockwise. You don't even need to select image you want to rotate, just hover mouse over it and press button that you require for that particular image.

Be the First to Share

    Recommendations

    • Pi Day Speed Challenge

      Pi Day Speed Challenge
    • Trash to Treasure Contest

      Trash to Treasure Contest
    • Microcontroller Contest

      Microcontroller Contest

    12 Comments

    1
    _Vyper
    _Vyper

    6 weeks ago

    Theoretically OpenCV Should be able to do this by using something like object/photo detection, as well as Deskewing to straighten the crooked ones (should be easier if the bed is all same dimension images too)

    0
    ScienceDiscoverer
    ScienceDiscoverer

    Reply 4 weeks ago

    Yes, I was thinking about that library... But I guess it's still too niche task to write full-fledged OpenCV program with it :D

    1
    _Vyper
    _Vyper

    Reply 4 weeks ago

    I'd even suggest trying to pose the idea to "Murtaza's Workshop" https://www.youtube.com/channel/UCYUjYU5FveRAscQ8V...
    He is pretty good with opencv and this is the type of thing he might do as a course/tutorial (no less useful as his suduko solver)

    0
    ScienceDiscoverer
    ScienceDiscoverer

    Reply 4 weeks ago

    I emailed him this idea to his mail that is listed on "about this channel" section. I'm not sure if he will notice it, tho, hehe. I noticed he has C++ tutorial on OpenCV tho. I probably should check it out, but IDK if I'll have time for this... 4 hours! WOW.

    1
    _Vyper
    _Vyper

    Reply 4 weeks ago

    his python ones are either the big 3+hr one or as bite sized topic specific ones - the c++ one only has a couple relevent sections to this project - though it is a cool tool

    1
    RenateSpeedy
    RenateSpeedy

    4 weeks ago

    A great project. Unfortunately, when installing nfainc.exe on Windows 10, I get the message that libstdc ++ - 6.dll, libgcc_s_dw2-l.dll and libwinpthread-l.dll are incorrect. Where is the mistake?

    1
    gcai_fwb
    gcai_fwb

    6 weeks ago

    Thank you for posting this excellent technique! I have a slightly different problem in that my analogues are slides however scanning a great whack of them and then using you technique should work very well.

    1
    dohelpinspire
    dohelpinspire

    6 weeks ago

    I wish I had this a year ago when I was doing all my album scanning.

    1
    alignbooks
    alignbooks

    7 weeks ago

    This is amazing work! this is helpful post for us

    GST Software.jpeg
    1
    jessyratfink
    jessyratfink

    7 weeks ago

    Great workflow! I bet this will save someone a good amount of time :)

    1
    ScienceDiscoverer
    ScienceDiscoverer

    Reply 7 weeks ago

    Thanks! I used some of my time to create this instructable in a hope that at least a few people will save their own time. Also this might motivate some people to scan thier photots if repetitivness and time costs stops them for now!