Giter VIP home page Giter VIP logo

gphoto2's Introduction

gphoto2

Partial Go bindings for http://www.gphoto.org/proj/libgphoto2/

History

Much of the code is copied from and/or insipired of https://github.com/szank/gphoto which seems abandonend and had a couple of bugs. I waanted to write a simple stop motion program and this is an artefact from it. So it's claiming to or trying to cover the whole library but you can do a lot, and I'm very open to suggestions and/or merge requests. I only have access to one Nikon camera so it's not tested with any other brand, and it seems like all camera manufacturers have their own quirks.

Installlation

To build the library you need to have libgphoto2-6 and libgphoto2-port12 or later installed.

Usage

Under examples are there a couple of basic usage examples for setting shutter speed, taking a photo, entering live view and copying images from there. A very simple example of taking a shot would be:

func main() {
	camera, err := gphoto2.NewCamera("")
	if err != nil {
		panic(fmt.Sprintf("%s: %s", "Failed to connect to camera, make sure it's around!", err))
	}
    snapFile := "/tmp/testshot.jpeg"
	if f, err := os.Create(snapFile); err != nil {
		fmt.Println("Failed to create temp file", snapFile, "giving up!", err)
	} else {
		fmt.Println("Taking shot, then copy to", snapFile)
		if err := c.CaptureDownload(f, false); err != nil {
			fmt.Println("Failed to capture!", err)
		}
	}
	camera.Exit()
	camera.Free()
}

Notes

For Nikon (I don't know about other cameras as I haven't been able to test with them) you want to put the DSLR in manual mode, and turn auto focus off typically. Manual mode is necessary to be able to change many of the settings, and to be able to enter live view mode for instance. Manual focus makes taking shots a lot more reliable and fast as the camera won't have to focus for each shot.

gphoto2's People

Contributors

jmojon avatar jonmol avatar

Stargazers

 avatar  avatar

Watchers

 avatar

gphoto2's Issues

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.