14

I currently have to take an image provided to me and crop it down to be considered a headshot. The problem is that this could be a few hundred photos a week. Does anyone know how to do this automatically, or even make it quicker? Surly my company is not the only company that does this on an enterprise level. Any assistance would be greatly appreciated.

The program must be able to:

  • Auto crop and re-size an image, Either by setting up a fixed camera/distance or using facial recognition.
  • It also must be able to do this in batch/bulk (multiple files).
  • It should run on windows, if it has to be a Mac I can make that work.
  • The image will be either a JPG or PNG. It needs to be in a specific format I can convert easily enough.
2
  • Must it do this for each face in photos with many faces? Or does it only need to cope with preselected photos containing only a single face? Commented Mar 14, 2014 at 2:51
  • 1
    Hey, it only needs to find one face per image. I have actually created a python script to do this. github.com/aDroidman/EyeonYou
    – Grady D
    Commented Mar 14, 2014 at 2:53

5 Answers 5

14

I'm guessing that you don't just crop the image but you have other things you'll be doing with the images before and after they're cropped. So I guess it's worthwhile to take a look at scripting the cropping as well as those other tasks.

If you want to do a facial recognition based cropping, you might want to look at OpenCV. OpenCV has a feature detection algorithms and also includes a pretrained classifier for facial detection. You can write a face detection and cropping script in probably about 10 lines of python code: http://docs.opencv.org/trunk/doc/py_tutorials/py_objdetect/py_face_detection/py_face_detection.html.

  • OpenCV runs on Windows, Linux, Mac, even Android or iOS
  • Can do batch processing, it had binding for many popular scripting languages
  • Supports PNG and JPEG
  • as long as you already have a pretrained classifier for the feature you want to detect, you wouldn't even need to know how those black magic works
  • and if you have to, you have the option to train your own classifier
2
  • This is a good option to look into for sure! I am hoping for something already made as I feel this is something that most enterprise businesses would need. If nothing shows up I will look into custom options/scripts
    – Grady D
    Commented Feb 19, 2014 at 1:59
  • 2
    Update to anyone who is looking for this. I have created a python script that does what is asked plus more. You can download the code from, github.com/aDroidman/EyeonYou
    – Grady D
    Commented Mar 14, 2014 at 3:01
6

You can try SNFaceCrop, a free, open source application for windows that has auto face detection and crops it automatically.

SNFaceCrop is a Windows-based application to detect and crop faces from an image file. The detected faces can be automatically saved into files or copied into the Windows clipboard. SNFaceCrop is open source and using OpenCV library for face detection.

Some features:

  • Detect the position of faces in an image file (BMP, JPG, or PNG)
  • Crop faces in an image automatically
  • Save detected faces in separate image files
  • Copy selected faces into clipboard
  • Adjust the size of the cropped faces before copying or saving them
  • Ability to do batch detection on multiple images

Screenshots:

Screenshot 1

Screenshot 2

5
  • 1
    Good program, it does not allow for batch images though. I need it to take separate images not break 1 image into many. Thanks though!
    – Grady D
    Commented Feb 19, 2014 at 1:27
  • @aDroidman Oh I see. I must have misunderstood.
    – aman207
    Commented Feb 19, 2014 at 2:08
  • @aDroidman: What about the last bulleted feature? "Ability to do batch detection on multiple images"? Commented Mar 14, 2014 at 2:55
  • This means, because I tried it, that it finds multiple faces per image. I was not able to make it work for multiple images. But I could be wrong and have overlooked the feature.
    – Grady D
    Commented Mar 14, 2014 at 2:56
  • Comment by fredless: "[It] does do batch mode. Check out the help menu selection for brief instructions on how you can use it this way. Works great."
    – Nicolas Raoul
    Commented Feb 8, 2018 at 6:09
1

If you have a fixed crop - i.e. the person is sitting roughly the same distance from the camera at roughly the same angle, Adobe Lightroom will do this in bulk and allow you to make adjustments to individual photos afterwards. It's not destructive - meaning that if you over-crop a photo you can still re-size the crop and include a portion that you've already chopped off.

You can even set it up to auto-crop the pictures as you are taking them (along with other adjustments) if your camera has a Live View mode.

Unfortunately, I don't know of one that will detect a face and automatically frame the head. That would be a cool feature.

2
  • Welcome to Software Recommendations. Your answer does not quite meet the expectations of the original question as it does not automatically detect faces. You can read this meta post on how to ask good and give good answers.
    – aman207
    Commented Feb 19, 2014 at 1:17
  • Thank you @TurtlePowered for this option. I will have to look into this and maybe a few other adobe products to see if I can make them work.
    – Grady D
    Commented Feb 19, 2014 at 1:32
1

Magic Crop did the trick super well for me. https://poloclub.github.io/magic-crop/

0

Disclaimer: Im the developer of this tool.

You can use Face Crop Jet to detect and crop faces from photos in Bulk.Images of any Format or Size is supported.Faces will be detected and cropped automatically(not just the face,a profile picture for id cards).You can also set a specific output size for the images.

The software can be downloaded from http://www.facecropjet.com

enter image description here

55$, free trial.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.