|  | @ -8,13 +8,6 @@ import numpy as np | 
			
		
	
		
		
			
				
					|  |  | from PIL import Image |  |  | from PIL import Image | 
			
		
	
		
		
			
				
					|  |  | from cat import cat |  |  | from cat import cat | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | # open image to be sent |  |  |  | 
			
		
	
		
		
			
				
					|  |  | image = sys.argv[1] |  |  |  | 
			
		
	
		
		
			
				
					|  |  | im = Image.open(image) |  |  |  | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  |  | 
			
		
	
		
		
			
				
					|  |  | pixels = list(im.getdata()) |  |  |  | 
			
		
	
		
		
			
				
					|  |  | width, height = im.size |  |  |  | 
			
		
	
		
		
			
				
					|  |  | pixels = [pixels[i * width:(i + 1) * width] for i in range(0,height)] |  |  |  | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | HOST, PORT = "px.oeinf.de", 1234 |  |  | HOST, PORT = "px.oeinf.de", 1234 | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  | @ -36,6 +29,17 @@ with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock: | 
			
		
	
		
		
			
				
					|  |  |     received = str(sock.recv(1024), "utf-8") |  |  |     received = str(sock.recv(1024), "utf-8") | 
			
		
	
		
		
			
				
					|  |  |     sizew = int(received.split(" ")[1]) |  |  |     sizew = int(received.split(" ")[1]) | 
			
		
	
		
		
			
				
					|  |  |     sizeh = int(received.split(" ")[2]) |  |  |     sizeh = int(received.split(" ")[2]) | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     # open image to be sent or query a cat image | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     if sys.argv[1] == 'cat': | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         im = cat(sizew,sizeh)  | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     else: | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         image = sys.argv[1] | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         im = Image.open(image) | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     pixels = list(im.getdata()) | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     width, height = im.size | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     pixels = [pixels[i * width:(i + 1) * width] for i in range(0,height)] | 
			
		
	
		
		
			
				
					|  |  |      |  |  |      | 
			
		
	
		
		
			
				
					|  |  |     # create list of stuff and shuffle if requested |  |  |     # create list of stuff and shuffle if requested | 
			
		
	
		
		
			
				
					|  |  |     widthlist = list(range(0 + startw,min(int(sizew),(width+startw)))) |  |  |     widthlist = list(range(0 + startw,min(int(sizew),(width+startw)))) | 
			
		
	
	
		
		
			
				
					|  | 
 |