TransWikia.com

Convert large database of mixed-format files into screen size jpegs

Photography Asked by The _traveler on December 30, 2020

I am an older photographer with an ever-increasing collectiob of 20,000+ images in folders arranged by year and month. (they are currently catalogues in Lightroom and the bad, non-interesting photos have been culled out) Two of my children have expressed strong interest in having the photos as a history of my efforts in photography.

I don’t want to require them to learn LR to view the pictures and would like to leave all the files in viewable size jpegs in the same named hierarchical structure as the LR database.

Lightroom just chokes on converting and resizing anything over 40 or 50 at a time. I’d prefer not to spend a month doing this.

Can anyone suggest a method to automate this?

2 Answers

If you have the technical skills to install Python3 and the Python Imaging Library on your computer, you can use this Python script:

# !/usr/bin/python3
import os
import sys
from PIL import Image

size = 128, 128

def thumbnail(fromFile,  toFile):
    _, ext = os.path.splitext(fromFile)
    if ext.lower() in ['.jpg', '.jpeg', '.png']:
      print('Creating thumbnail', toFile)
      im = Image.open(fromFile)
      im.thumbnail(size)
      im.save(file + ".thumbnail", "JPEG")

[_, fromDir, toDir] = sys.argv
for root, dirs, files in os.walk(fromDir, topdown=True):
   for name in dirs:
      toPath = os.path.join(toDir, root, name)
      print('Making', toPath)
      os.makedirs(toPath, 0o777, True)

   for name in files:
      fromFile = os.path.join(root, name)
      toFile = os.path.join(toDir, root, name)
      thumbnail(fromFile,  toFile)

Run it like this: python3 scriptname sourcedir destdir

Remember that sourcedir must be a relative pathname. If you have a file named /usr/traveler/mystuff/images/2009/Mar/IMG3.jpg, go to the directory /usr/traveler/mystuff, and use python3 scriptname images thumbnails, the output will be in /usr/traveler/mystuff/thumbnails/images/2009/Mar/IMG3.jpg

Answered by Malvolio on December 30, 2020

I can't stop recommending IrfanView if you use windows. Just be careful with the options you choose, specially Overwriting and deleting files, make some tests with dummy files and folders before running any batch script. Make a backup of your original files.

enter image description here

File > Batch Conversion / Rename

And in Advanced options, you can choose to create subfolders.

You can simply drag folders from the top preview window into the bottom list.

Irfan View recognizes a lot of file formats, and you can choose to export them all into jpg, define the quality of the files, apply some sharpening, etc.

Answered by Rafael on December 30, 2020

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