X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/42faac096df5479bd7747d9068eb88d1410d6d34..aa021ad04c81969c58558343fb1ff2409c82563e:/apps/sorl/thumbnail/utils.py diff --git a/apps/sorl/thumbnail/utils.py b/apps/sorl/thumbnail/utils.py deleted file mode 100644 index 18b18b0b..00000000 --- a/apps/sorl/thumbnail/utils.py +++ /dev/null @@ -1,170 +0,0 @@ -import math -import os -import re - - -re_thumbnail_file = re.compile(r'(?P.+)_(?P\d+)x(?P\d+)' - r'(?:_(?P\w+))?_q(?P\d+)' - r'(?:.[^.]+)?$') -re_new_args = re.compile('(? 1 and split_arg[1] or None - args_dict[split_arg[0]] = value - return args_dict - - -def image_entropy(im): - """ - Calculate the entropy of an image. Used for "smart cropping". - """ - 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])