Changeset 442 for pkpgcounter/trunk
- Timestamp:
- 12/16/06 21:44:34 (18 years ago)
- Location:
- pkpgcounter/trunk/pkpgpdls
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
pkpgcounter/trunk/pkpgpdls/inkcoverage.py
r439 r442 49 49 if img.mode != "RGB" : 50 50 img = img.convert("RGB") 51 data = img.getdata()52 51 cyan = magenta = yellow = black = 0 53 for (r, g, b) in data:52 for (r, g, b) in img.getdata() : 54 53 if r == g == b : 55 54 black += 255 - r … … 66 65 def getPercentGC(img, nbpix) : 67 66 """Determines if a page is in grayscale or colour mode.""" 68 result = getPercentCMYK(img, nbpix) 69 if result["C"] == result["M"] == result["Y"] == 0.0 : 70 return { "G" : 100.0, "C" : 0.0 } 71 else : 72 return { "G" : 0.0, "C" : 100.0 } 67 if img.mode != "RGB" : 68 img = img.convert("RGB") 69 gray = 0 70 for (r, g, b) in img.getdata() : 71 if not (r == g == b) : 72 # optimize : if a single pixel is no gray the whole page is colored. 73 return { "G" : 0.0, "C" : 100.0 } 74 return { "G" : 100.0, "C" : 0.0 } 73 75 74 76 def getPercentBW(img, nbpix) : -
pkpgcounter/trunk/pkpgpdls/version.py
r439 r442 23 23 24 24 25 __version__ = "2.1 3"25 __version__ = "2.14alpha" 26 26 27 27 __doc__ = """pkpgcounter : a generic Page Description Languages parser."""