Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Pyautogui屏幕截图。它去哪里了?以后如何保存和查找?_Python_Windows_Python 3.x_Automation_Pyautogui - Fatal编程技术网

Python Pyautogui屏幕截图。它去哪里了?以后如何保存和查找?

Python Pyautogui屏幕截图。它去哪里了?以后如何保存和查找?,python,windows,python-3.x,automation,pyautogui,Python,Windows,Python 3.x,Automation,Pyautogui,我从艾尔·斯维加特的YouTube视频中学到了自动化无聊的东西。我开始拍摄截图。他在视频中没有真正解释,所以我测试了一下。我发现它可以截取整个桌面的截图,但我不知道它们去了哪里。我只能在整个电脑搜索时找到它,我不知道如何从那里把它放进文件夹 基本上,我是在问如何存储图像并找到由pyautogui.screenshot()函数拍摄的图像。我现在不打算用它做任何事情,我只是想知道怎么做。我去了pyautogui网站,但没有找到任何关于在哪里查找以及如何保存屏幕截图的信息。提前感谢您抽出时间 以下是有

我从艾尔·斯维加特的YouTube视频中学到了自动化无聊的东西。我开始拍摄截图。他在视频中没有真正解释,所以我测试了一下。我发现它可以截取整个桌面的截图,但我不知道它们去了哪里。我只能在整个电脑搜索时找到它,我不知道如何从那里把它放进文件夹


基本上,我是在问如何存储图像并找到由
pyautogui.screenshot()
函数拍摄的图像。我现在不打算用它做任何事情,我只是想知道怎么做。我去了pyautogui网站,但没有找到任何关于在哪里查找以及如何保存屏幕截图的信息。提前感谢您抽出时间

以下是有关在pyautogui中保存屏幕截图的文档链接:

screenshot函数返回一个PIL.Image。您可以使用其保存方法将其保存到文件中

import pyautogui
im1 = pyautogui.screenshot()
im1.save(r"c:\path\to\my\screenshot.png")
您还可以在screenshot方法调用中传递保存文件的路径:

import pyautogui
pyautogui.screenshot(r"c:\path\to\my\screenshot1.png")
你有没有遵循

它清楚地说: PyAutoGUI可以拍摄屏幕截图,将其保存到文件中,并在屏幕中定位图像, 调用screenshot()将返回一个图像对象,可以用不同的方式调用它:

>>> im1 = pyautogui.screenshot()  # return an image object
>>> im2 = pyautogui.screenshot('my_screenshot.png')  # image name will be as per parameter
>>> im3 = pyautogui.screenshot(region=(0,0, 300, 400)) # mention spedific region to get the screenshot 
所有返回一个图像对象,可根据需要在以后使用/保存:

>>> im1.size()  # will return a dimension of image as a tuple  
>>> im2.save("<imagepath where you wish to save your image >") # save the image
>>> im.getpixel((100, 200)) # return color value of the point mentioned 
>im1.size()#将以元组形式返回图像的维度
>>>im2.保存(“”)#保存图像
>>>im.getpixel((100200))#返回所述点的颜色值
希望这有帮助:)