
    /~hR                     N    d dl mZmZ d Zd Z eej                  de      Zd Zy)   )Image	ImageModec                     t        j                  | j                        }| j                  \  }}||z  t	        |j
                        z  S )z Return the number of color values in the input image --
        this is the number of pixels times the band count
        of the image.
    )r   getmodemodesizelenbands)imagemode_descriptorwidthheights       `/var/www/peopleoo.sandbox-dev.co.uk/venv/lib/python3.12/site-packages/pilkit/processors/utils.pycolor_countr      s?    
  ''

3OJJME66>C 5 5666    c                     ddl mm} t        t	        |             fd| j                         D        } |fd|D               S )z0 Calculate the entropy of an images' histogram.     )log2fsumc              3   (   K   | ]	  }|z    y w)N ).0histocolhistosums     r   	<genexpr>z'histogram_entropy_py.<locals>.<genexpr>   s     GH$Gs   c              3   @   K   | ]  }|d k7  s	| |      z    yw)g        Nr   )r   pr   s     r   r   z'histogram_entropy_py.<locals>.<genexpr>   s     <18T!W<s   
)mathr   r   floatr   	histogram)r   r   	histonormr   r   s      @@r   histogram_entropy_pyr"      s:    ['(HGU__5FGI<i<<<<r   entropyc                     | j                          | j                  | S | j                  | j                  j                        S )z1 Convert a palette image to a non-palette image. )loadpaletteconvertr   )r   s    r   resolve_paletter(      s5     
JJL}}==++,,r   N)libr   r   r   r"   getattrhistogram_entropyr(   r   r   r   <module>r,      s-    "7= EKK4HI -r   