I've recently changed my system from using command line gphoto2 to the python module Gphoto2 due to better camera control and getting system information.
Before I was able to take a photo and save it with a custom name.
os.system('var=$(gphoto2 --capture-image-and-download --filename="/temp/img-'+ time_photo_taken +'.jpg")')
How do I achieve this with the current script:
camera = gp.Camera() camera.init() print('Capturing image') file_path = camera.capture(gp.GP_CAPTURE_IMAGE) print('Camera file path: {0}/{1}'.format(file_path.folder, file_path.name)) target = os.path.join('/temp/', file_path.name) print('Copying image to', target) camera_file = camera.file_get( file_path.folder, file_path.name, gp.GP_FILE_TYPE_NORMAL) camera_file.save(target) camera.exit()
Would I need to add another function that looks for the photo in the temp folder then renames it? or is there a way to do it as the photo is taken?
https://stackoverflow.com/questions/66148546/python-gphoto2-custom-name-save February 11, 2021 at 11:55AM
没有评论:
发表评论