mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-03 23:53:54 +00:00
add get image size func
This commit is contained in:
parent
15233120e0
commit
0eda71b5e5
13
robotgo.go
13
robotgo.go
@ -63,7 +63,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
version string = "v0.48.0.511, Ben Nevis!"
|
version string = "v0.48.0.514, Ben Nevis!"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
@ -1092,6 +1092,17 @@ func CountColorCS(x, y, w, h int, color CHex, args ...float32) int {
|
|||||||
return rx
|
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 New Issue
Block a user