goclipimg

package module
v0.0.0-...-357bf74 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: BSD-3-Clause Imports: 4 Imported by: 2

README

goclipimg

tests

This is just a tiny library that helps you getting an image from your clipboard into your application.

Requirements

Linux

If you are running X11 you will need to have xclip installed.

On Wayland you will need wl-clipboard.

Windows

On Windows, this simply invokes a PowerShell script. Sadly this causes the library to open a PowerShell window, unless you are already running inside of a terminal.

Example

func main() {
    data, err := goclipimg.GetImageFromClipboard()
    if err == nil {
        doSomethingWithYourPNG(data)
    }
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrImagePasteUnsupported = errors.New("xclip/wl-clipboard is not available on this system")

ErrImagePasteUnsupported means that xclip(X11) or wl-clipboard(Wayland) can't be found or isn't installed.

View Source
var (

	// ErrNoImageInClipboard means that no data was returned.
	ErrNoImageInClipboard = errors.New("the clipboard doesn't contain an image")
)

Functions

func GetImageFromClipboard

func GetImageFromClipboard() ([]byte, error)

GetImageFromClipboard returns either a byte array containing PNG data or an error that indicates that no png could be retrieved.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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