Skip to content
/ xwd Public

xwd image for golang

License

Notifications You must be signed in to change notification settings

atotto/xwd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xwd image library for golang

example:

func main() {
	f, err := os.Create("screenshot.png")
	if err != nil {
		log.Fatal(err)
	}
	defer f.Close()

	ctx := context.Background()
	m, err := xwd.Capture(ctx)
	if err != nil {
		log.Fatal(err)
	}
	if err := png.Encode(f, m); err != nil {
		log.Fatal(err)
	}
}
// $ xwd -root -display :0 -out screenshot.xwd
func xwd2png(w io.Writer, r io.Reader) error {
	m, err := xwd.Decode(r)
	if err != nil {
		return err
	}
	if err := png.Encode(w, m); err != nil {
		return err
	}
	return nil
}

About

xwd image for golang

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages