0

I'm looking for code to handle shots with Picamera2. I want:

  • Take photo with the camera
  • Show plan on screen for x seconds
  • Save photo as jpeg image.

I try the code below but can't find how to adjust the image preview display time.

#!/usr/bin/python3
import time
from picamera2 import Picamera2, Preview
i = 0

picam2 = Picamera2()
picam2.start_preview(Preview.QTGL)
preview_config = picam2.create_preview_configuration()
capture_config = picam2.create_still_configuration()

picam2.configure(preview_config)
picam2.start()
time.sleep(2)

while True:
    i = i + 1
    file_name = "photo" + str(i) + ".jpg"

    picam2.switch_mode_and_capture_image(capture_config)

Best regards

1 Answer 1

0

On page 12 of the PiCamera2 manual:

picam2.start()
time.sleep(2)
picam2.stop_preview()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.