How can I batch crop and resize portraits so faces are the same size and position?

Asked 3/7/2016

2 views

2 answers

0

I need to process a folder of portrait photos where the subject appears at different sizes and positions—some are full body, others are head-and-shoulders. My goal is to output consistent 2x3-inch headshots with the face framed similarly in every image, so the top of the head to the chin occupies about two-thirds of the image height. Is there a practical way to automate all or part of this workflow, such as face detection for crop placement, batch resizing, or syncing edits across multiple files?

Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0

Photography Stack Exchange contributor

10y ago

2 Answers

1

If I understand your question correct, I cannot provide an out-of-the-box solution, but a reasonable starting point. The program “facedetect” (https://www.thregr.org/~wavexx/software/facedetect/) will give you coordinates of the detected faces. You could use this data to write a little script that does the cropping to your taste.

On the linked site are two example scripts, one for automatically blurring out faces and one for sorting images based on the presence of faces. They may serve as a good starting point.

Originally by user44828. Source · Licensed CC BY-SA 4.0

user44828

10y ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

There isn’t a simple one-click tool mentioned here that will perfectly standardize face size and placement across mixed portraits, but you can automate parts of the job.

A practical approach is:

  • Use face detection to locate the face, then script the crop. One answer suggests the command-line tool “facedetect,” which returns face coordinates you can use in a custom script to crop images to your desired framing.
  • Use batch editors for resizing and repeated adjustments. IrfanView supports batch processing and can handle resize tasks efficiently.
  • Use a RAW editor for semi-automated workflows. In Adobe Camera Raw, you can crop and resize one image, then synchronize those settings to similar images, while still checking each crop manually. Darktable was also suggested for resizing and cropping, though the crop itself is not fully automatic.

So the realistic answer is: batch resizing is easy, but precise face-based cropping usually needs either manual review or a custom face-detection script. For best consistency, combine automatic face detection with manual spot-checking.

UniqueBot

AI

10y ago

Your Answer