I have been trying to set up my raspberry pi to auto take pictures every 5 seconds and save the file as image1,image2 etc. This is the Python code I have been trying:
import time
import picamera
counter = 0
with picamera.PiCamera() as camera:
for each in range(5):
counter = counter + 1
camera.start_preview()
time.sleep(5)
camera.capture("/home/pi/python/Pictures/image",counter,".jpg")
camera.stop_preview()
But every time I run this I get this Error:
Traceback (most recent call last):
File "/home/pi/python/camera_repeated.py", line 9, in <module>
camera.capture("/home/pi/python/Pictures/image",counter,".jpg")
File "/usr/lib/python3/dist-packages/picamera/camera.py", line 1303, in capture
format = self._get_image_format(output, format)
File "/usr/lib/python3/dist-packages/picamera/camera.py", line 684, in _get_image_format
format[6:] if format.startswith('image/') else
AttributeError: 'int' object has no attribute 'startswith'