Apple - How to take photo using Terminal?

Use FFMPEG.

(This has become one of my favorite command line utilities for video/audio conversion and streaming)

According to the FFMPEG Wiki, you can use Apple's AVFoundation to capture directly from the FaceTime Camera or any other USB web cam that's attached. Keep in mind, the wiki was written when the FaceTime camera was still called the iSight so some of the features/keywords are no longer valid

Get the device ID

$ ffmpeg -f avfoundation -list_devices true -i ""

[AVFoundation input device @ 0x7fda1bc152c0] AVFoundation video devices:
[AVFoundation input device @ 0x7fda1bc152c0] [0] FaceTime HD Camera (Built-in)
[AVFoundation input device @ 0x7fda1bc152c0] [1] Capture screen 0
[AVFoundation input device @ 0x7fda1bc152c0] AVFoundation audio devices:
[AVFoundation input device @ 0x7fda1bc152c0] [0] USB Audio CODEC
[AVFoundation input device @ 0x7fda1bc152c0] [1] Built-in Microphone

The device we're looking for is "0"

Capture the photo

$ ffmpeg -ss 0.5 -f avfoundation -i "0" -t 1 capture.jpg

What this does is take a 1 second video stream, takes the single fram starting at .5 seconds and saves it as a JPEG called capture.jpg