Skip to content

Screenshot/Capture take too long time on MacOS #731

Open
@cnwangjie

Description

@cnwangjie
  • Robotgo version (or commit ref): v0.110.8
  • Go version: go1.24.4 darwin/arm64
  • Gcc version: Apple clang version 16.0.0 (clang-1600.0.26.6)
  • Operating system and bit: macOS 15.4.1
  • Resolution: 2056x1329
  • Can you reproduce the bug at Examples:
    • Yes (provide example code)
    • No
    • Not relevant
  • Provide example code:
package main

import (
	"github.com/go-vgo/robotgo"
)

func main() {
	robotgo.CaptureImg()
}
  • Log gist:
time go run main.go
go run main.go  0.96s user 0.95s system 12% cpu 15.653 total

Description

Just a CaptureImg call took 15s in my device. I'm not sure if it performs similarly on other OS.

I think the syscall with bitmap spend too much time.

Python's pillow library uses the subprocess method instead of syscall. It has great performance. I think we can refer to their implementation.

https://github.com/python-pillow/Pillow/blob/222b86222ea005936089a7086da24c95bc6cc3db/src/PIL/ImageGrab.py#L33-L116

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions