Skip to content
프로젝트

소개

데스크톱 화면을 이미지로 캡처하는 Go 라이브러리

디자인 및 미디어

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
+3
in 15 days
+3
in 1 month
+5

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

screenshot

Go Report Card

  • Go library to capture desktop screen.
  • Multiple display supported.
  • Supported GOOS: windows, darwin, linux, freebsd, openbsd, and netbsd.
  • cgo free except for GOOS=darwin.

example

  • sample program main.go

    package main
    
    import (
        "github.com/kbinani/screenshot"
        "image/png"
        "os"
        "fmt"
    )
    
    func main() {
        n := screenshot.NumActiveDisplays()
    
        for i := 0; i < n; i++ {
            bounds := screenshot.GetDisplayBounds(i)
    
            img, err := screenshot.CaptureRect(bounds)
            if err != nil {
                panic(err)
            }
            fileName := fmt.Sprintf("%d_%dx%d.png", i, bounds.Dx(), bounds.Dy())
            file, _ := os.Create(fileName)
            defer file.Close()
            png.Encode(file, img)
    
            fmt.Printf("#%d : %v \"%s\"\n", i, bounds, fileName)
        }
    }
    
  • output example

    $ go run main.go
    #0 : (0,0)-(1280,800) "0_1280x800.png"
    #1 : (-293,-1440)-(2267,0) "1_2560x1440.png"
    #2 : (-1373,-1812)-(-293,108) "2_1080x1920.png"
    $ ls -1
    0_1280x800.png
    1_2560x1440.png
    2_1080x1920.png
    main.go
    

coordinate

Y-axis is downward direction in this library. The origin of coordinate is upper-left corner of main display. This means coordinate system is similar to Windows OS

license

MIT Licence

author

kbinani

관련 프로젝트 살펴보기

불러오는 중…