# 导入模块
import tkinter
import cv2
from PIL import ImageGrab
 
def jydp_screenshot(img_out_dir):
    # 获取当前分辨率下的屏幕尺寸
    win = tkinter.Tk()
    width = win.winfo_screenwidth()
    height = win.winfo_screenheight()

    img = ImageGrab.grab(bbox=(0, 0, width, height)) # 全屏幕截图
    img.save('{}jy_client.png'.format(img_out_dir)) # 保存截图
    img=cv2.imread('{}jy_client.png'.format(img_out_dir),1)
    cv2.imwrite('{}jy_client.jpg'.format(img_out_dir),img,[cv2.IMWRITE_JPEG_QUALITY,50]) # 压缩图片(保存格式必须为jpg才能压缩)


jydp_screenshot('Mor/')

 

相关文章:

  • 2021-11-22
  • 2022-12-23
  • 2021-12-24
  • 2022-12-23
  • 2021-07-02
  • 2022-12-23
  • 2022-02-09
猜你喜欢
  • 2022-02-09
  • 2022-02-09
  • 2022-02-09
  • 2022-12-23
  • 2022-02-09
相关资源
相似解决方案