Brigadoon - An Occasional Corner on the Internet
IP Sky Camera Image Capture Software
Designed by Mark Little
 
With the IP camera installed and enabled, it is time to take a still image. This can be easily done by enter the following command on the command line:

wget --header="Authorization:Basic <Base64>" http://<ip_address>:<port>/snapshot.cgi

Where <base64> is the Base64 representation of your username and password in the format "username:password". A base64 encoder can be found at this site. The <ip_address> is the IP address of the camera, and <port> is the port number to use.

The image will be returned with the name snapshot.cgi and then renamed.

It is now time to create the scrip file that will be used to capture the images.

sudo nano /usr/local/sbin/skycamera.sh

The "sudo" command means that editor should be run with same privileges as root. If this does not work, you can "su root" and then just use "nano /usr/local/sbin/skycamera_ip.sh". When you are in the editor, enter the following text as shown, but with your Base64 value and IP address and port:

#! /bin/bash
#
# Script to capture images from an Sricam IP Camera,
# scale and upload to a web server.
#

# Capture the Image from the Camera
cd /tmp
wget --header="Authorization:Basic <Base64>" http://<ip_address>:<port>/snapshot.cgi
mv snapshot.cgi uploaded_skyimage.jpg

# End of Scrip
t

Once you have saved this script, the script needs to be set to allow it to execute. This can be done by entering the following command:

sudo chmod 755 /usr/local/sbin/skycamera.sh

Now, it should simply be a matter of waiting at least five (5) minutes and then looking into the "/tmp" directory. In there, there should be a file called "skyimage.jpg". View the image to confirm that it is a picture from your camera. Wait another five (5) minutes and you should see that the image has updated. You have now completed the second requirement of capturing an image from the camera.

The size of the image will depend on the IP camera setting, but the largest possible image is 1280 by 720 pixels and 78.1kB. The next requirement is to reduce the size of the image to be compatible with the requirements of the web server to which the image will be uploaded.
Next