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: 10 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 6 years ago)
- Default Branch: master
- Last Pushed: 2020-01-30T20:49:51.000Z (about 6 years ago)
- Last Synced: 2025-03-29T17:11:08.842Z (11 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 main
import (
"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)
}
```