o
    Y+i7                     @   s    d Z ddlZdd Zdd ZdS )zs
This module implements all the functions to communicate with other Python
modules (PIL, matplotlib, mayavi, etc.)
    Nc                 C   s
   t | S )zt Transforms a PIL/Pillow image into a numpy RGB(A) image.
        Actually all this do is returning numpy.array(im).)nparray)im r   L/var/www/html/venv/lib/python3.10/site-packages/moviepy/video/io/bindings.pyPIL_to_npimage	   s   
r   c           	      C   sf   ddl m} || }|  |jjj\}}}}t|t|}}| }tj	|tj
d}|||dS )zF Converts a matplotlib figure to a RGB frame after updating the canvasr   )FigureCanvasAgg)dtype   )matplotlib.backends.backend_aggr   drawfigurebboxboundsinttostring_rgbr   
frombufferuint8reshape)	figr   canvaslbwhbufimager   r   r   mplfig_to_npimage   s   r   )__doc__numpyr   r   r   r   r   r   r   <module>   s    	