Take multiple pictures on demand using Raspberry Pi python code
The python code below takes as many pictures you want as long as you keep pressing enter and saves images in a specified folder (in this case "images") with image names "image1.jpg" , "image2.jpg", etc., from picamera import PiCamera from time import sleep camera = PiCamera() camera.rotation = 270 i = 0 while not raw_input("Press enter for a photo"): i = i + 1 camera.start_preview(alpha=200) sleep(1) image_path = "./images/image"+str(i)+".jpg" camera.capture(image_path) camera.stop_preview() print("image successfully saved in the path: "+image_path) Important things to remember You could also use input() instead of raw_input() function based on the python version. make sure the folder exists already. This code might not create a new folder. Do while in python doesn't exist.