简体   繁体   English

使用gphoto2捕获图像时如何创建校验和

[英]how to create checksums while images are captured with gphoto2

I want to create an MD5 hash for each shot captured with gphoto2. 我想为用gphoto2捕获的每个镜头创建一个MD5哈希。

I tried to run this command 我试图运行此命令

sudo gphoto2 -capture-image-and-download -force-overwrite \
 -filename capture.jpg -I 10 && md5sum capture.jpg > md5.txt

but the checksum writes only when gphoto2 was stopped. 但是校验和仅在gphoto2停止时才写入。 I need to write it for each shot as it is captured? 我需要为拍摄的每个镜头编写它吗?

gphoto2 versions newer than 2.3.0 have the option --hook-script FILENAME ; 高于2.3.0的gphoto2版本具有--hook-script FILENAME选项; you could write a short script file, eg named hook.sh : 您可以编写一个简短的脚本文件,例如,名为hook.sh

case $ACTION in download) md5sum "$ARGUMENT" >md5.txt
esac

(don't forget to make it executable) and then (不要忘记使其可执行),然后

sudo gphoto2 -capture-image-and-download -force-overwrite \
 -filename capture.jpg -I 10 --hook-script hook.sh

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM