U
    d@                     @   s(   d dl mZmZ dddZd	ddZdS )
    )ImageUnidentifiedImageErrorFc                 C   s@   |  |rdnd} | d}ddt|  }|| }| }|S )NZRGBAZRGB)   r   #z%02x)convertZgetpixellenupper)imgalphaZpixel_colorZcolor_formatcolor r   4/tmp/pip-unpacked-wheel-gyyeoqb6/colorfield/utils.pyget_image_background_color   s    
r   c              	   C   sB   d}z$t | }t||}W 5 Q R X W n tk
r<   Y nX |S )N )r   openr   r   )Zimg_filer
   r   imager   r   r   get_image_file_background_color   s    r   N)F)F)ZPILr   r   r   r   r   r   r   r   <module>   s   
	