如何将Windows屏幕坐标转换为屏幕截图像素坐标?
我需要在屏幕截图上找到一个控件。我有它的屏幕坐标。如何将它们转换为屏幕截图上的坐标?
I need to find a control on screenshot. I have its screen coordinates. How can I convert them to coordinates on screenshot?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这完全取决于屏幕截图的大小和当前分辨率的大小。
假设屏幕截图为 800x600,但您当前的屏幕分辨率为 1280x720。为了找出 800x600 图像上的 X,Y 位置,您需要标准化 1280x720 屏幕上的 X,Y 值。
请注意,您要查找的对象在 800x600 图像上也较小。所以:
It all depends on the size of the screenshot and the size of your current resolution.
Let's say the screenshot is 800x600, but your current screen resolution is 1280x720. In order to find out the X,Y position on a 800x600 image, you need to normalize the values you have of X,Y on a 1280x720 screen.
Note that the object you are looking for is also smaller on a 800x600 image. So: