def _getVirtualScreenBitmap(self):
        """ Returns a bitmap of all attached screens """
        filenames = []
        screen_details = self.getScreenDetails()
        for screen in screen_details:
            fh, filepath = tempfile.mkstemp('.png')
            filenames.append(filepath)
            os.close(fh)
        subprocess.call(['screencapture', '-x'] + filenames)

        min_x, min_y, screen_w, screen_h = self._getVirtualScreenRect()
        virtual_screen = Image.new("RGB", (screen_w, screen_h))
        for filename, screen in zip(filenames, screen_details):
            # Capture virtscreen coordinates of monitor
            x, y, w, h = screen["rect"]
            # Convert image size if needed
            im = Image.open(filename)
            im.load()
            if im.size[0] != w or im.size[1] != h:
                im = im.resize((int(w), int(h)), Image.ANTIALIAS)
            # Convert to image-local coordinates
            x = x - min_x
            y = y - min_y
            # Paste on the virtual screen
            virtual_screen.paste(im, (x, y))
            os.unlink(filename)
        return virtual_screen
Returns a bitmap of all attached screens