ODK d dl Z d dlZd dlmZmZ d dlmZ d dlmZ e j e Z G d de Z d Z G d d e ZdS ) N)Image ImageChops)grab)Displayc e Zd ZdS )DisplayTimeoutErrorN)__name__ __module____qualname__ o/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/pyvirtualdisplay/smartdisplay.pyr r s Dr r c | j dk r| d } t j d| j | }t j | | }| }|r| | S dS )zCrop borders off an image. :param im: Source image. :param bgcolor: Background color, using either a color tuple. :return: An image without borders, or None if there's no actual content in the image. RGBN) modeconvertr newsizer differencegetbboxcrop)imbgcolorbgdiffbboxs r autocropr ss w% ZZ 5"'7 + +B R((D<<>>D wwt}}4r c $ e Zd Zd ZddZddZdS ) SmartDisplayc , t || j S )zCrop borders off an image. :param im: Source image. :return: An image without borders, or None if there's no actual content in the image. )r _bgcolor)selfr s r r zSmartDisplay.autocrop" s DM***r Tc ^ t | j }|r| | }|S )N)xdisplay)r new_display_varr )r" r imgs r r zSmartDisplay.grab* s3 D0111 %--$$C r <