def snapshot(self, filename=None, quality=10, max_size=None):
        """
        Take a screenshot and save it in ST.LOG_DIR folder

        Args:
            filename: name of the file to give to the screenshot, {time}.jpg by default
            quality: The image quality, integer in range [1, 99]
            max_size: the maximum size of the picture, e.g 1200

        Returns:
            display the screenshot

        """
        if self.app:
            rect = self.get_rect()
            rect = self._fix_image_rect(rect)
            monitor = {"top": rect.top, "left": rect.left, "width": rect.right - rect.left - abs(self.monitor["left"]),
                       "height": rect.bottom - rect.top, "monitor": 1}
        else:
            monitor = self.screen.monitors[0]
        try:
            with mss.mss() as sct:
                sct_img = sct.grab(monitor)
                screen = numpy.array(sct_img, dtype=numpy.uint8)[..., :3]
                if filename:
                    aircv.imwrite(filename, screen, quality, max_size=max_size)
                return screen
        except:
            # if mss.exception.ScreenShotError: gdi32.GetDIBits() failed.
            return self.snapshot_old(filename, quality, max_size)

        Take a screenshot and save it in ST.LOG_DIR folder

        Args:
            filename: name of the file to give to the screenshot, {time}.jpg by default
            quality: The image quality, integer in range [1, 99]
            max_size: the maximum size of the picture, e.g 1200

        Returns:
            display the screenshot

        
airtest/core/win/win.py