ó
P'—^c           @   s*   d  d l  m Z d e f d „  ƒ  YZ d S(   iÿÿÿÿ(   t   Imaget   ColorOverlayc           B   s#   e  Z d  Z d d „ Z d „  Z RS(   s7   
    Overlay a color mask with a the given opacity
    g      à?c         C   s   | |  _  | |  _ d S(   s¥   
        :pamra color: `ImageColor` instance to overlay on the original image
        :param overlay_opacity: Define the fusion factor for the overlay mask

        N(   t   colort   overlay_opacity(   t   selfR   R   (    (    s;   /tmp/pip-unpacked-wheel-gNgxnH/pilkit/processors/overlay.pyt   __init__	   s    	c      	   C   s…   | j  d ƒ } } t j d | j |  j ƒ } t j d | j d d d t d |  j d ƒ f ƒ } t j | | | ƒ j  d ƒ } | S(   Nt   RGBt   RGBAi    g      ð?iÿ   (   t   convertR    t   newt   sizeR   t   intR   t	   composite(   R   t   imgt   originalt   overlayt   mask(    (    s;   /tmp/pip-unpacked-wheel-gNgxnH/pilkit/processors/overlay.pyt   process   s
    5(   t   __name__t
   __module__t   __doc__R   R   (    (    (    s;   /tmp/pip-unpacked-wheel-gNgxnH/pilkit/processors/overlay.pyR      s   	N(   t
   pilkit.libR    t   objectR   (    (    (    s;   /tmp/pip-unpacked-wheel-gNgxnH/pilkit/processors/overlay.pyt   <module>   s   