Changeset 409 for trunk/game


Ignore:
Timestamp:
11/29/09 22:47:33 (10 years ago)
Author:
zenbitz
Message:

changed tail to minimum 35 px (I hope)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/game/utilities/slicer_pil.py

    r408 r409  
    6868    return True  
    6969         
    70 def sliceImage(filename, slice_width=70): 
     70def sliceImage(filename, slice_width=70, tail_width=105): 
    7171    """ Opens an image, and produces slice_width pixel wide slices of it 
    7272        @type filename: String 
     
    9494    num = 0 
    9595    while current_pos + slice_width < img_width: 
     96        remainder = img_width - current_pos 
     97        log.info("Remainder: %d" % remainder) 
     98        if remainder < tail_width + slice_width: 
     99            break 
    96100        # Save the slice  
    97101        if not saveSlice(img, filename, num, current_pos, \ 
     
    102106        current_pos += slice_width  
    103107     
    104     # Handle the tail 
     108    # Handle the tail tail is now bigger 
    105109    if(current_pos < img_width): 
    106110        if not saveSlice(img, filename, num, current_pos, \ 
    107111                         img_width-1, slice_width): 
    108             log.info("Failed to save slice: %d", num) 
     112            log.info("Failed to save tail slice: %d", num) 
    109113            return False  
    110114    return True 
     
    146150    log.addHandler(ch) 
    147151     
    148     if sliceImage(file, 70): 
     152    if sliceImage(file, 70, 35): 
    149153        log.info("Done") 
    150154    else: 
Note: See TracChangeset for help on using the changeset viewer.