Activity Stream
93,440 MEMBERS
29 ONLINE
Slicing images with Python and PIL Slicing images with Python and PIL Slicing images with Python and PIL Slicing images with Python and PIL Slicing images with Python and PIL
Results 1 to 1 of 1
  1.    Tweet this post   Share This Post On Facebook Share This Post On Google+
    #1
    Programmar
    Xcode's Avatar

    Idea Slicing images with Python and PIL

    Source Code : 
    def process_floor_image(infileoutfilecopy_pics):
        
    """
        Copy the orignal image and make also 1024 x 1024 sliced tiles out of it. 
     
        Because our green robot friend sucks.
     
        @return Image size in [width, height]
        """
     
     
        
    im Image.open(infile)
     
        
    im.size[0]
        
    im.size[1]
        
    dimensions = [ w]
     
        if 
    copy_pics:
     
            
    # Copy master
            
    path os.path.dirname(outfile)
            
    base os.path.basename(outfile)
     
            try:
                
    os.makedirs(path)
            
    except OSError:
                
    pass
     
            
    print "Copying image:" outfile
            shutil
    .copyfile(infileoutfile)
     
            
    # slice the image to 1000 x 1000 tiles
            
    slice_size 1000
            
    for y in range(0hslice_size):
                for 
    x in range(0wslice_size):

    [Login or Register to remove this advertisement]

                    
    fname os.path.join(path"tile-%d-%d-%s" % (xybase)) 
                    print 
    "Creating tile:" fname
     
                    mx 
    min(x+slice_sizew)
                    
    my min(y+slice_sizeh)
     
                    
    buffer Image.new("RGB", [slice_sizeslice_size], (255255255))                                
                    
    tile im.crop((xymxmy))
                    
    buffer.paste(tile, (00))                                
                    
    buffer.save(fname"PNG")
     
        return 
    dimensions 
    Xcode Reviewed by Xcode on . Slicing images with Python and PIL def process_floor_image(infile, outfile, copy_pics): """ Copy the orignal image and make also 1024 x 1024 sliced tiles out of it. Because our green robot friend sucks. @return Image size in """ Rating: 5

  2. The Following 2 Users Say Thank You to Xcode For This Useful Post:
    [ Click to Expand ]

    is0l4ted (15th November 2012),Rebel (4th March 2012)

  3.   Advertisements

Thread Information

Users Browsing this Thread

There Are Currently 1 Users Browsing This Thread. (0 Members and 1 Guests)

Similar Threads

  1. Using svg images into JasperReport
    By Xcode in forum XML
    Replies: 0
    Last Post: 17th March 2013, 04:14 PM
  2. Space Images v1.4.1
    By mangyang in forum Android OS Applications
    Replies: 0
    Last Post: 28th April 2012, 06:59 AM
  3. Super Python v2.5
    By usitaly in forum Python S60 Zone
    Replies: 0
    Last Post: 7th September 2011, 02:03 AM
  4. Golden Python 1.00 by mEnPDA -.::Run all python's apps::.-
    By Mobile_Guru in forum Python S60 Zone
    Replies: 1
    Last Post: 18th June 2011, 09:14 PM
  5. Replies: 1
    Last Post: 1st March 2011, 06:04 PM

Tags for this Thread

BE SOCIAL
Slicing images with Python and PIL Slicing images with Python and PIL Slicing images with Python and PIL Slicing images with Python and PIL Slicing images with Python and PIL