mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-01 06:33:56 +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 (
|
||||
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 New Issue
Block a user