Taking photos with the Pi Camera Module is easy once you have plugged it in and made the correct configuration changes. In order to do this make sure you have read my Installing The Raspberry Pi Camera Module page.
Once you’ve completed the camera installation you won’t need to do it again and you can concentrate on taking photos and recording HD video.
Basic Photo Capture
Capturing stills is done using the raspistill command line utiltity and is as easy as typing :
raspistill -o myimage.jpg
This takes a photo which is then saved as “myimage.jpg”. By default the image is previewed on the screen and is captured after a 5 second delay. You can change the delay by using the “-t” option and supplying a time in milliseconds.
In the example below we take a photo with a delay of 3 seconds (3000 milliseconds) :
raspistill -o myimage.jpg -t 3000
This is a list of some of the more common options available when using raspistill :
-?, --help : This help information -w, --width : Set image width <size> -h, --height : Set image height <size> -q, --quality : Set jpeg quality <0 to 100> -o, --output : Output filename <filename> -v, --verbose : Output verbose information during run -t, --timeout : Time (in ms) before taking picture (if not specified, set to 5s) -th, --thumb : Set thumbnail parameters (x:y:quality) -d, --demo : Run a demo mode -e, --encoding : Output format (jpg, bmp, gif, png) -tl, --timelapse : Timelapse mode. Takes a picture every <t>ms -p, --preview : Preview window settings <'x,y,w,h'> -f, --fullscreen : Fullscreen preview mode -n, --nopreview : Do not display a preview window -sh, --sharpness : Set image sharpness (-100 to 100) -co, --contrast : Set image contrast (-100 to 100) -br, --brightness : Set image brightness (0 to 100) -sa, --saturation : Set image saturation (-100 to 100) -ISO, --ISO : Set capture ISO -vs, --vstab : Turn on video stablisation -rot, --rotation : Set image rotation (90,180,270) -hf, --hflip : Set horizontal flip -vf, --vflip : Set vertical flip
To get a full list of options that can be used type :
raspistill | less
Scroll using the arrow keys and press q to return to the command line.
Depending on how you position your camera you may need to use the “-rot” option to ensure your photos are the right way around.
Time Lapse Photo Capture
Another great feature of the utility is the easy capture of a series of images over a specified period of time. You could write your own software to do this but for speed you can’t beat the time lapse options provided :
raspistill -o myimage_%d.jpg -tl 2000 -t 25000
The -tl option sets the time between photos (in milliseconds) and the -t option sets the total time the sequence will last. So in this example a photo will be taken every two seconds (2000ms) for a total time of twenty five seconds (25000ms).
In this example we take a photo every minute (60000 milliseconds) for a total time of 2 hours (2 x 60 x 60 x 1000 milliseconds) :
raspistill -o myimage_%d.jpg -tl 60000 -t 7200000
The “%d” results in a sequence of numbered images being produced. In this case you would get images named :
myimage_1.jpg myimage_2.jpg myimage_3.jpg myimage_4.jpg ...
If you change the “%d” to “%04d” you can pad the numbers with zeroes to always give four digits. I much prefer this as it gives you a sequence that looks like :
myimage_0001.jpg myimage_0002.jpg myimage_0003.jpg myimage_0004.jpg ...
As I experiment with the camera I will add other posts and cover some more advanced techniques but until then have fun!