libgphoto2绑定了一个力求惯用的接口

gphoto2-cffi的Python项目详细描述


python与libgphoto2的绑定,接口力求 习惯用语。与python的其他绑定不同,gphoto2 cffi隐藏了大部分 低层抽象并在仍然 提供对图书馆大部分功能的访问。

importgphoto2cffiasgp# List all attached cameras that are supportedcams=gp.list_cameras()# Get a camera instance by specifying a USB bus and device numbermy_cam=gp.Camera(bus=4,device=1)# Get an instance for the first supported cameramy_cam=gp.Camera()# ormy_cam=next(gp.list_cameras())# Capture an image to the camera's RAM and get its dataimgdata=my_cam.capture()# Grab a preview from the camerapreviewdata=my_cam.get_preview()# Get a list of files on the camerafiles=tuple(my_cam.list_all_files())# Iterate over a file's contentwithopen("image.jpg","wb")asfp:forchunkinmy_cam.files[0].iter_data():fp.write(chunk)# Get a configuration valueimage_quality=my_cam.config['capturesettings']['imagequality'].value# Set a configuration valuemy_cam.config['capturesettings']['imagequality'].set("JPEG Fine")

支持Python2.7和3.4或更新版本(cpython和pypyy)。

要求

  • libgphoto2,带有开发标题
  • 一个有效的c编译器
  • CFFI

安装

来源:

$ pip install git+https://github.com/jbaiter/gphoto2-cffi.git

类似项目

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
使用Selenium Java查找筛选器窗格“铅笔图标”的元素时出现问题   分布式缓存l2上使用infinispan和hibernate的java连接锁   使用Java的DOM XML API解析XML中的符号和   java是解析和操作字符串的有效方法   java发布NewRelicMeterRegistry时如何过滤仪表   多维数组在java中读取文件后将数据值分组   java如何将httpClient配置为jsoup   java BreakIterator在Android中是如何工作的?   找不到maven GAE类:原因:java。lang.ClassNotFoundException应用程序标识cRedential$AppenginecRedential包装   Jlabel调整java大小   调试如何在VScode中的java类依赖项中设置断点   java正在获取文件夹名,而不是。mp3文件{Android}   java如何将从DiffieHellman类生成的AES密钥添加到使用该密钥的类