From 0eda71b5e53ee674a39e7740fc7d1e5a70828a61 Mon Sep 17 00:00:00 2001 From: vcaesar Date: Tue, 13 Feb 2018 18:56:57 +0800 Subject: [PATCH] add get image size func --- robotgo.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/robotgo.go b/robotgo.go index 00ee423..3223415 100644 --- a/robotgo.go +++ b/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 +} + /* ___________ ____ _______ .__ __. .___________. | ____\ \ / / | ____|| \ | | | |