remove unnecesary functions
							parent
							
								
									c1ddbd6254
								
							
						
					
					
						commit
						9df07dcabd
					
				| 
						 | 
					@ -16,21 +16,6 @@ def img_to_array(img: Image) -> np.array:
 | 
				
			||||||
    img_array = np.array(img)
 | 
					    img_array = np.array(img)
 | 
				
			||||||
    return img_array
 | 
					    return img_array
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def _avg_colors(img: Image) -> tuple:
 | 
					 | 
				
			||||||
    img_array = img_to_array(img)
 | 
					 | 
				
			||||||
    avg_colors = np.mean(img_array, axis=tuple(range(img_array.ndim - 1)))
 | 
					 | 
				
			||||||
    avg_list = list(map(int, avg_colors))
 | 
					 | 
				
			||||||
    avg_list[3] = 255
 | 
					 | 
				
			||||||
    return tuple(avg_list)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
def __avg_colors(pil_img):
 | 
					 | 
				
			||||||
    img = pil_img.copy()
 | 
					 | 
				
			||||||
    img.convert("RGB")
 | 
					 | 
				
			||||||
    img.resize((1, 2), resample=0)
 | 
					 | 
				
			||||||
    dominant_color = img.getpixel((0, 0))
 | 
					 | 
				
			||||||
    print(img.getpixel((0, 1)))
 | 
					 | 
				
			||||||
    return dominant_color
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
def avg_colors(img):
 | 
					def avg_colors(img):
 | 
				
			||||||
    img_array = img_to_array(img)
 | 
					    img_array = img_to_array(img)
 | 
				
			||||||
    colors, count = np.unique(img_array.reshape(-1,img_array.shape[-1]), axis=0, return_counts=True)
 | 
					    colors, count = np.unique(img_array.reshape(-1,img_array.shape[-1]), axis=0, return_counts=True)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue