mirror of
https://github.com/go-vgo/robotgo
synced 2026-05-24 10:19:01 +00:00
add get image size func
This commit is contained in:
parent
15233120e0
commit
0eda71b5e5
1 changed files with 12 additions and 1 deletions
13
robotgo.go
13
robotgo.go
|
|
@ -63,7 +63,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
version string = "v0.48.0.511, Ben Nevis!"
|
||||
version string = "v0.48.0.514, Ben Nevis!"
|
||||
)
|
||||
|
||||
type (
|
||||
|
|
@ -1092,6 +1092,17 @@ func CountColorCS(x, y, w, h int, color CHex, args ...float32) int {
|
|||
return rx
|
||||
}
|
||||
|
||||
// GetImgSize get the image size
|
||||
func GetImgSize(imgPath string) (int, int) {
|
||||
bitmap := OpenBitmap(imgPath)
|
||||
gbit := ToBitmap(bitmap)
|
||||
|
||||
x := gbit.Width / 2
|
||||
y := gbit.Height / 2
|
||||
|
||||
return x, y
|
||||
}
|
||||
|
||||
/*
|
||||
___________ ____ _______ .__ __. .___________.
|
||||
| ____\ \ / / | ____|| \ | | | |
|
||||
|
|
|
|||
Loading…
Reference in a new issue