def image_entropy(im):
    if not isinstance(im, Image.Image):
        # Can only deal with PIL images. Fall back to a constant entropy.
        return 0
    hist = im.histogram()
    hist_size = float(sum(hist))
    hist = [h / hist_size for h in hist]
    return -sum([p * math.log(p, 2) for p in hist if p != 0])
@param trajectory_handler: The TrajectoryHandler containing the coordinates as prody-like coordsets.
dataset/ETHPy150Open SmileyChris/easy-thumbnails/easy_thumbnails/utils.py/image_entropy--crossover with--dataset/ETHPy150Open victor-gil-sepulveda/pyProCT/pyproct/clustering/evaluation/metrics/pcaMetrics.py/PCAMetric.__init__