Show
Ignore:
Timestamp:
12/10/06 19:15:07 (17 years ago)
Author:
jerome
Message:

Now recognizes the GC pseudo colorspace to differentiate
between grayscale and coloured pages.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pkpgcounter/trunk/pkpgpdls/inkcoverage.py

    r433 r439  
    6464           } 
    6565         
     66def getPercentGC(img, nbpix) :         
     67    """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 } 
     73     
    6674def getPercentBW(img, nbpix) : 
    6775    """Extracts the percents of Black from a picture, once converted to gray levels.""" 
     
    92100    colorspace = colorspace.upper() 
    93101    computation = globals()["getPercent%s" % colorspace] 
    94     if colorspace == "CMYK" : # faster with psyco on my machine 
     102    if colorspace in ("CMYK", "GC") : # faster with psyco on my machine 
    95103        try : 
    96104            import psyco 
     
    98106            pass 
    99107        else :     
    100             psyco.bind(computation) 
     108            psyco.bind(getPercentCMYK) 
    101109     
    102110    index = 0