Capture and FTP upload a webcam image

To install web cam capture software on the Raspberry Pi

sudo apt-get install fswebcam

To test

fswebcam -d /dev/video0 -r 720x480 webcam.jpeg

Python Code to take picture and upload to web

#!/usr/bin/env python

import os
import ftplib

os.system("fswebcam -d /dev/video0 -r 384x288 /var/www/webcam.jpeg")

print ("Starting FTP")
session = ftplib.FTP('ftp.com','ftp@ftp.com','asdfasdfasdfasdf')
file = open('/var/www/webcam.jpeg','rb') # file to send
session.storbinary('STOR webcam.jpeg', file) # send the file
file.close() # close file and FTP
session.quit()
print ("Finished FTP")
Logitech QuickCam Pro 9000 Web Cam
Logitech QuickCam Pro 9000 Web Cam $2.20
End Date: Friday Oct-26-2018 12:36:55 PDT
Logitech QuickCam Pro 9000 Web Cam
Logitech QuickCam Pro 9000 Web Cam $29.95
End Date: Thursday Nov-15-2018 8:23:12 PST
Buy It Now for only: $29.95
Logitech Pro 9000 PC Webcam
Logitech Pro 9000 PC Webcam $10.40
End Date: Friday Oct-26-2018 10:20:58 PDT
Logitech QuickCam Pro 9000 V U0009 Camera 2MP Autofocus Zeiss Lens
Logitech QuickCam Pro 9000 V U0009 Camera 2MP Autofocus Zeiss Lens $13.88
End Date: Monday Oct-29-2018 21:43:15 PDT
Buy It Now for only: $13.88
Logitech QuickCam Pro 9000 Web Cam
Logitech QuickCam Pro 9000 Web Cam $7.00
End Date: Saturday Oct-20-2018 17:22:58 PDT
Logitech QuickCam Pro 9000 Web Cam 2 Megapixel w Auto Focus Computer Camera
Logitech QuickCam Pro 9000 Web Cam 2 Megapixel w Auto Focus Computer Camera $29.95
End Date: Sunday Nov-11-2018 18:23:13 PST
Buy It Now for only: $29.95
NEW Logitech QuickCam Pro 9000 HD Web Cam Carl Zeiss Optics 32
NEW Logitech QuickCam Pro 9000 HD Web Cam Carl Zeiss Optics 32 $35.00
End Date: Saturday Oct-20-2018 11:38:12 PDT
Buy It Now for only: $35.00
Logitech 860000109 QUICKCAM PRO9000
Logitech 860000109 QUICKCAM PRO9000 $25.00
End Date: Friday Nov-16-2018 12:31:31 PST
Buy It Now for only: $25.00
Logitech QuickCam Pro 9000 Web Cam
Logitech QuickCam Pro 9000 Web Cam $24.95
End Date: Friday Nov-16-2018 7:28:26 PST
Buy It Now for only: $24.95
Logitech QuickCam Pro 9000 WebCam Autofocus Carl Zeiss lens+RightLight Tech
Logitech QuickCam Pro 9000 WebCam Autofocus Carl Zeiss lens+RightLight Tech $18.95
End Date: Wednesday Oct-31-2018 20:42:01 PDT
Buy It Now for only: $18.95

« Previous12345...910

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>