clipboard

package module
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: May 30, 2021 License: MIT Imports: 6 Imported by: 0

README

clipboard-image

Copy image to clipboard

Supported OS

  • Windows
  • Mac
  • Linux/Unix

Requirements

  • xclip(linux only)
  • file(linux only)

Usage

Copy image file to clipboard.

f, err := os.Open("image.png")
if err != nil {
	log.Fatal(err)
}
deder f.Close()

if err := clipboard.Write(f); err != nil {
	log.Fatal(err)
}

Read image file from clipboard.

r, err := clipboard.Read()
if err != nil {
	log.Fatal(err)
}

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

if _, err := io.Copy(f, r); err != nil {
	log.Fatal(err)
}

Author

skanehira

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Read

func Read() (io.Reader, error)

Read read image from clipboard

func Write

func Write(r io.Reader) error

Write write image to clipboard

Types

This section is empty.

Jump to

Keyboard shortcuts

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