Changeset 439 for pkpgcounter/trunk

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.

Location:
pkpgcounter/trunk
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • pkpgcounter/trunk/bin/pkpgcounter

    r418 r439  
    6969  -cCOLORSPACE, --colorspace=COLORSPACE 
    7070                        Activate the computation of ink usage, and defines the 
    71                         colorspace to use. Supported values are 'BW', 'RGB', 
    72                         'CMYK', and 'CMY'. 
     71                        colorspace to use. Supported values are 'BW' (Black), 
     72                        'RGB', 'CMYK', 'CMY', and 'GC' (Grayscale vs Color). 
     73                        'GC' is useful if you only need to differentiate  
     74                        grayscale pages from coloured pages but don't care 
     75                        about ink usage per se. 
    7376                         
    7477  -rRESOLUTION, --resolution=RESOLUTION 
  • pkpgcounter/trunk/NEWS

    r437 r439  
    2222pkpgcounter News : 
    2323 
     24  * 2.13 :  
     25    
     26    - Nowrecognizes the GC colorspace if you only want to differentiate 
     27      grayscale pages from coloured pages. In this colorspace, the 
     28      percents are always "G : 100.0   C : 0.0" or "G : 0.0   C : 100.0" 
     29      respectively for a grayscale page and a coloured page. 
     30   
    2431  * 2.12 : 
    2532   
  • pkpgcounter/trunk/pkpgpdls/analyzer.py

    r434 r439  
    211211                            dest="colorspace", 
    212212                            type="cichoice", 
    213                             cichoices=["bw", "rgb", "cmyk", "cmy"], 
    214                             help="Activate the computation of ink usage, and defines the colorspace to use. Supported values are 'BW', 'RGB', 'CMYK', and 'CMY'.") 
     213                            cichoices=["bw", "rgb", "cmyk", "cmy", "gc"], 
     214                            help="Activate the computation of ink usage, and defines the colorspace to use. Supported values are 'BW', 'RGB', 'CMYK', 'CMY', and 'GC'.") 
    215215    parser.add_option("-r", "--resolution",  
    216216                            type="int",  
  • 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 
  • pkpgcounter/trunk/pkpgpdls/version.py

    r437 r439  
    2323 
    2424 
    25 __version__ = "2.12" 
     25__version__ = "2.13" 
    2626 
    2727__doc__ = """pkpgcounter : a generic Page Description Languages parser."""