Easy picking the best photos with IrfanView and NodeJS

Dec 28, 2015

On vacation time I take hundreds of photos, most of them are duplicates or not-really-interesting. I was looking for photo viewer that has option to select best pictures, to place in digital photo frame... Didn't found any so I made it myself with IrfanView and NodeJS

1. Plan

We are going to use IrfanViews "open with external editor" option. After pressing `SHIFT+1`, `SHIFT+2` or `SHIFT+3` user-defined executable is started with image path.

Now we just have to write code that copies given image file to specific directory. I will use `Best Photos` directory.

2. Implementation

  1. Install NodeJS
  2. Make sure if `node` command is available by typing `node -v` in command line
  3. Create "irfan-copy.bat" file in "C:\Users\{YourName}\"
  4. Paste following code to "irfan-copy.bat"
    node -e "var fs=require('fs');var path=require('path');var img=process.argv[1];var mkdirSync=function(path){try{fs.mkdirSync(path);}catch(e){if(e.code != 'EEXIST') throw e;}};var target=path.join(path.dirname(img), 'Best Photos'); mkdirSync(target); fs.createReadStream(img).pipe(fs.createWriteStream(path.join(target, path.basename(img))));" %*
  5. Open IrfanView
  6. Go to Options -> Proporties/Settings...
  7. Navigate to Miscellaneous
  8. In Set external editors (1) section paste following:
  9. Press OK in the left

3. Selecting pictures in action

All is set now. Just press SHIFT+1 when you decide to pick the photo, and voila! It's copied to `./Best Photos/` directory.

ps. With minimal modifications this method will work with any OS - MacOS, Linux etc.