Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/codenoid/go-screenshot
Go package for taking screenshot from Linux+, Windows-, Mac-
https://github.com/codenoid/go-screenshot
go-library screenshot x11
Last synced: 3 months ago
JSON representation
Go package for taking screenshot from Linux+, Windows-, Mac-
- Host: GitHub
- URL: https://github.com/codenoid/go-screenshot
- Owner: codenoid
- Created: 2019-12-23T04:07:08.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-01-30T20:49:51.000Z (almost 5 years ago)
- Last Synced: 2024-10-09T06:01:31.626Z (3 months ago)
- Topics: go-library, screenshot, x11
- Language: Go
- Size: 2.93 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Go Screenshot
another library for taking screenshot on your Linux+,Windows-,Mac-
there is many feature that still missing (like choosing display, set size, etc), and currently only support for linux, and don't worry about [this bug](https://github.com/BurntSushi/xgb/issues/32) because you can open once and reuse xgb connection
## Installation
```
go get -u github.com/codenoid/go-screenshot
```## Usage
```
package mainimport (
"image/jpeg"
"os"screenshot "github.com/codenoid/go-screenshot"
)func main() {
// start xgb session, you can reuse this for anything else
xgbconn, err := screenshot.NewSession()
if err != nil {
return
}
defer xgbconn.Close()// call screenshot method
ss := screenshot.Start{
XgbConn: xgbconn,
}// capture current screen frame
img, err := ss.CaptureScreen()f, err := os.Create("screenshot.jpg")
if err != nil {
panic(err)
}
defer f.Close()jpeg.Encode(f, img, nil)
}
```