Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Is there a command line utility that allows me to take a picture from the built in camera? Something like screencapture allows for, well, screen captures.

The reasoning for a command line tool is I would like for it to be stealthy, without a countdown or flash or other indication to the user that a picture is being taken.

share|improve this question
    
Take a look at the source code for preyproject.com -- they do this stuff with their app and the code for it is open source. –  Ian C. Apr 29 '12 at 23:41
    
Remember that the green LED next to the iSight will briefly activate when the camera records the image. –  da4 Oct 5 '12 at 17:17
add comment

4 Answers

OS X does not come with any utilities for this purpose.

A third-party solution is imagesnap. It lets you capture an image from any connected video device, defaulting to the built-in iSight camera. It's available as a single binary file you could bundle with your software, and is released into the public domain.

There are many references around the internet to the iSightCapture utility, which used to be a popular choice for this, but it is no longer maintained.

share|improve this answer
    
Anything native? –  dacracot Jul 21 '11 at 22:45
    
@dacracot Unfortunately Apple hasn't provided anything like this. –  Jeremy Banks Jul 21 '11 at 22:46
add comment

Natively, there is a way but it is extremely basic. You can use Automator to make an application that takes a picture. The action is called "Take Video Snapshot" and requires a "built-in camera, iSight or other webcam, or digital camera connected to your computer." Just check the box to take picture automatically and you now have an app you can call from the command line. Save it as an app and then you can call it from the command line like open TakePicture.app.

Take Video Snapshot

share|improve this answer
    
Tried this and it worked, but I was hoping for something more stealthy. –  dacracot Aug 26 '11 at 15:17
    
@dacracot I figured as much. Like I said, this is the only native way I know of so you'll have to go the hard route if you want stealth. –  styfle Aug 26 '11 at 15:48
add comment

As the previous poster mentioned there is a utility called iSightCapture which can do this.

I once wrote a script to periodically grab an iSight image and a screencapture grab of my two monitors and post it to a private website so I could see what's going on at my computer. Here's how I scripted isightcapture to do so.

#!/bin/bash
~/scripts/isightcapture -w 320 -h 240 -t jpg ~/capture.jpg 
RESULT=$?
if [ $RESULT -ne 0 ]; then
    growlnotify -s -a FaceTime -m "isightcapture failed ($RESULT)" $0
    exit 1
else
    sips -f horizontal ~/capture.jpg
fi

screencapture -S -tjpg ~/scr1.jpg ~/scr2.jpg 
RESULT=$?
if [ $RESULT -ne 0 ]; then
    growlnotify -s -a FaceTime -m "screencapture failed ($RESULT)" $0
    exit 2
else 
    sips -z 240 320 ~/scr1.jpg 
    sips -z 240 320 ~/scr2.jpg
fi
exit 0

Note the use of 'sips' to flip the isight capture horizontally.

A working download link (2012-10-05): iSightCapture (via), tested on OSX 10.8.2

share|improve this answer
add comment

Use imagesnap. It can be installed with brew install imagesnap or by downloading the binary from the website.

One use for it is to take series of snapshots:

while :; do
    imagesnap ~/Desktop/$(date +%y%m%d%H%M%S).png
    sleep ${1-1}
done

It doesn't crop images horizontally either. (Photo Booth changes the aspect ratio to 3:2.)

share|improve this answer
3  
this answer should be accepted, as it works great –  mikezter Jan 11 '13 at 10:19
    
+1. This should be accepted –  Sirens May 16 '13 at 1:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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