Reindent autocrop with 4 spaces

This commit is contained in:
Aarni Koskela 2023-05-11 18:13:35 +03:00
parent 483545252f
commit 098d2fda52

View File

@ -25,6 +25,7 @@ def crop_image(im, settings):
elif is_portrait(settings.crop_width, settings.crop_height):
scale_by = settings.crop_height / im.height
im = im.resize((int(im.width * scale_by), int(im.height * scale_by)))
im_debug = im.copy()
@ -260,10 +261,11 @@ def image_entropy(im):
hist = hist[hist > 0]
return -np.log2(hist / hist.sum()).sum()
def centroid(pois):
x = [poi.x for poi in pois]
y = [poi.y for poi in pois]
return PointOfInterest(sum(x)/len(pois), sum(y)/len(pois))
return PointOfInterest(sum(x) / len(pois), sum(y) / len(pois))
def poi_average(pois, settings):
@ -320,10 +322,10 @@ class PointOfInterest:
def bounding(self, size):
return [
self.x - size//2,
self.y - size//2,
self.x + size//2,
self.y + size//2
self.x - size // 2,
self.y - size // 2,
self.x + size // 2,
self.y + size // 2
]