JPEG+RAW : Download ONLY jpeg file but save raw on memory card #156
-
I've been attempting for the past few months to find a way to only download the jpeg for preview purposes while leaving/saving the raw file on the camera sdcard. i basically want to replicate gphoto2's --keep-raw option like in
If i use capturetarget_cfg.set_value('Memory card'), this code doesn't work and the files are only saved to the camera
Edit: I'm using the current python-gphoto2 v2.3.4 and latest libgphoto2 v2.5.30 / gphoto2 v2.5.28 and a Canon EOS m200 |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
I don't have that camera model but I expect you need to do the following: |
Beta Was this translation helpful? Give feedback.
-
using camera.trigger_capture() instead of camera.capture() did not give any file added event. With a bit of fiddling and better error logging i managed to do what i wanted the following way, thanks to another discussion i found on here #cleanup previous files
test = os.listdir(ROOT_DIR + WORK_DIR)
for item in test:
if item.endswith(".jpg"):
os.remove(os.path.join(ROOT_DIR + WORK_DIR, item))
path = camera.capture(gp.GP_CAPTURE_IMAGE)
#empty the event queue
hasPreview = False
typ,data = camera.wait_for_event(200)
while typ != gp.GP_EVENT_TIMEOUT:
if typ == gp.GP_EVENT_FILE_ADDED:
if data.name.lower().endswith(".jpg"):
fn = os.path.join(data.folder,data.name)
messageQueue.append([ "camera_event", "text", "Downloading PREVIEW file: %s" % fn ])
camera_file = camera.file_get(
data.folder, data.name, gp.GP_FILE_TYPE_NORMAL)
camera_file.save(template % timestamp)
messageQueue.append([ "camera_event", "preview", ('frame%012d.jpg' % timestamp) ])
hasPreview = True
#try to grab another event
typ,data = camera.wait_for_event(1) I'm not sure if waiting for gp_event_timeout is the proper way to go, but at least that works, albeit probably not in a very trustworthy way. Ie: can i be sure i'll always get the .jpg for the file added event? iirc previous tests i got the .cr3 instead. Time will tell i guess Thx for the tip @jim-easterbrook, and thanks a bunch for the library wrapper, it's really nice to be able to mess with my camera for my projects! |
Beta Was this translation helpful? Give feedback.
-
Hi, I'm trying the same workflow on my Nikon D5300 but I couldn't find a way to store the raw and jpeg files on the camera's sdcard. I would appreciate if you could share the complete capture code. |
Beta Was this translation helpful? Give feedback.
using camera.trigger_capture() instead of camera.capture() did not give any file added event. With a bit of fiddling and better error logging i managed to do what i wanted the following way, thanks to another discussion i found on here