Giter VIP home page Giter VIP logo

gphoto2-cffi's Introduction

gphoto2-cffi

Python bindings for libgphoto2 with an interface that strives to be idiomatic. In contrast to other bindings for Python, gphoto2-cffi hides most of the lower-level abstractions and reduces the API surface while still offering access to most of the library's features.

import gphoto2 as gp

# List all attached cameras that are supported
cams = gp.list_cameras()

# Get a camera instance by specifying a USB bus and device number
my_cam = gp.Camera(bus=4, device=1)

# Get an instance for the first supported camera
my_cam = gp.Camera()
# or
my_cam = next(gp.list_cameras())

# Capture an image to the camera's RAM and get its data
imgdata = my_cam.capture()

# Grab a preview from the camera
previewdata = my_cam.get_preview()

# Get a list of files on the camera
files = tuple(my_cam.list_all_files())

# Iterate over a file's content
with open("image.jpg", "wb") as fp:
    for chunk in my_cam.files[0].iter_data():
        fp.write(chunk)

# Get a configuration value
image_quality = my_cam.config['capturesettings']['imagequality'].value
# Set a configuration value
my_cam.config['capturesettings']['imagequality'].set("JPEG Fine")

Currently only Python 2.7 and 3.4 (CPython and PyPy) are supported, however support for 2.6 and 3.3 is planned for the future.

Requirements

  • libgphoto2 with development headers
  • A working C compiler
  • cffi

Installation

From Source:

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

Similar projects

gphoto2-cffi's People

Contributors

jbaiter avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.