Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Capture the screen in Go?

Tags:

go

Is there is a cross-platform way to capture the screen in Google's Go? Or any way for that matter, but cross platform would be preferred.

like image 619
user1889993 Avatar asked Dec 09 '12 19:12

user1889993


People also ask

How do I take a screenshot of go?

Press the Power and Volume down buttons at the same time. If that doesn't work, press and hold the Power button for a few seconds. Then tap Screenshot.

How do I take a screenshot of a full page scroll?

Press and hold Ctrl + Alt together, then press PRTSC. A red-highlighted rectangular box will appear. Now, press and hold the mouse left-click. Next, drag the mouse on the scrolling window to select the area.

What is the shortcut to take a screenshot?

On your desktop or laptop, press the Print Screen button on your keyboard to take a screenshot. You may also take a screenshot using the CTRL + Print Screen shortcut. Windows takes a full-screen screenshot and saves it to the clipboard. Next, paste the image from the clipboard into an image editing tool like Paint.


1 Answers

Now there is:

https://github.com/vova616/screenshot

go get github.com/vova616/screenshot

Example:

package main

import "github.com/vova616/screenshot"

func main() {
    img, err := screenshot.CaptureScreen() // *image.RGBA
    myImg := image.Image(img) // can cast to image.Image, but not necessary
}

If you need macOS support as well (until the pull request is merged), get:

https://github.com/kesarion/screenshot

like image 199
Kesarion Avatar answered Oct 03 '22 08:10

Kesarion