Skip to content

Latest commit

 

History

History
33 lines (27 loc) · 613 Bytes

README.md

File metadata and controls

33 lines (27 loc) · 613 Bytes

GoCam

In simple words it is a tool that allows you to take photos on windows with golang. Yes, this returns an image.Image. And of course I plan to make this work on Linux. The goal is to have a simple way to take a photo on linux and windows with golang

Get Photo

package main

import (
	"fmt"

	"github.com/AndrusGerman/gocam"
)

func main() {
	devices, err := gocam.GetListDevices()
	if err != nil {
		panic(err)
	}

	camera, err := gocam.NewCamera(devices[0])
	if err != nil {
		panic(err)
	}

	photo, err := camera.GetPhoto()
	if err != nil {
		panic(err)
	}
	fmt.Println("Photo: ", photo)
}