Working version with RAW and JPEG
This commit is contained in:
parent
6b4cb074eb
commit
0acb2f0a0c
18
scanner.py
18
scanner.py
|
|
@ -18,16 +18,20 @@ def capture(camera, output_path: str) -> bool:
|
|||
print('Camera file path: {0}/{1}'.format(file_path.folder, file_path.name))
|
||||
target = output_path + '.cr2'
|
||||
print('Copying image to', target)
|
||||
|
||||
camera_file = camera.file_get(file_path.folder, file_path.name, gp.GP_FILE_TYPE_RAW)
|
||||
camera_file.save(target)
|
||||
|
||||
camera_file = camera.file_get(file_path.folder, file_path.name, gp.GP_FILE_TYPE_PREVIEW)
|
||||
camera_file.save(output_path + '.jpg')
|
||||
print(file_path.folder, file_path.name[:-3] + 'JPG')
|
||||
camera_file_jpg = camera.file_get(file_path.folder, file_path.name[:-3] + 'JPG', gp.GP_FILE_TYPE_NORMAL)
|
||||
camera_file_jpg.save(output_path + '.jpg')
|
||||
|
||||
camera_file_raw = camera.file_get(file_path.folder, file_path.name, gp.GP_FILE_TYPE_RAW)
|
||||
camera_file_raw.save(target)
|
||||
|
||||
camera.exit()
|
||||
camera.init()
|
||||
s = True
|
||||
except:
|
||||
|
||||
except Exception as e:
|
||||
print(f'Somethings wrong on gphoto2')
|
||||
print(e)
|
||||
s = False
|
||||
|
||||
return s
|
||||
|
|
|
|||
Loading…
Reference in New Issue