Changeset 278 for pkpgcounter/trunk/pkpgpdls/inkcoverage.py
- Timestamp:
- 11/02/05 20:35:58 (19 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pkpgcounter/trunk/pkpgpdls/inkcoverage.py
r277 r278 24 24 import sys 25 25 26 import psyco27 28 26 from PIL import Image 29 27 … … 42 40 nbpix = sum(r) 43 41 for histo in (r, g, b) : 44 value = 0 45 for i in range(len(histo)) : 46 value += histo[i] * (255 - i) 47 result.append((100 * (value / 255.0)) / nbpix) 42 result.append((100 * (reduce(lambda x,y: x + (y[1] * (255 - y[0])), enumerate(histo), 0) / 255.0)) / nbpix) 48 43 return tuple(result) 49 44 50 45 if __name__ == "__main__" : 51 psyco.bind(percent_cmy)52 46 print percent_cmy(sys.argv[1])