xwd

package module
v0.0.0-...-17da451 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 12, 2021 License: MIT Imports: 7 Imported by: 0

README

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
}

Documentation

Overview

Package xwd implements the xwd (X Window dump) image library.

https://en.wikipedia.org/wiki/Xwd

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Capture

func Capture(ctx context.Context) (image.Image, error)

func Decode

func Decode(r io.Reader) (img image.Image, err error)

func DumpXWindowImage

func DumpXWindowImage(ctx context.Context, w io.Writer) error

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL