diff --git a/src/PIL/ImageStat.py b/src/PIL/ImageStat.py index b7ebddf066a..c0f647024a8 100644 --- a/src/PIL/ImageStat.py +++ b/src/PIL/ImageStat.py @@ -21,9 +21,7 @@ # See the README file for information on usage and redistribution. # -import functools import math -import operator class Stat: @@ -69,10 +67,7 @@ def minmax(histogram): def _getcount(self): """Get total number of pixels in each layer""" - v = [] - for i in range(0, len(self.h), 256): - v.append(functools.reduce(operator.add, self.h[i : i + 256])) - return v + return [sum(self.h[i : i + 256]) for i in range(0, len(self.h), 256)] def _getsum(self): """Get sum of all pixels in each layer"""