scale and crop image to be returned as a thumbnail
This commit is contained in:
		
							parent
							
								
									a462f169e4
								
							
						
					
					
						commit
						7d87b428b1
					
				
							
								
								
									
										11
									
								
								hcatitles.py
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								hcatitles.py
									
									
									
									
									
								
							@ -20,11 +20,12 @@ def update_image(original, title, subtitle):
 | 
			
		||||
 | 
			
		||||
def update_thumbnail(image):
 | 
			
		||||
    """genreate thumbnail from original image"""
 | 
			
		||||
    """454-720"""
 | 
			
		||||
    thumbnail = image.resize((720, 360))
 | 
			
		||||
    white = (255, 255, 255, 255)
 | 
			
		||||
    ImageDraw.floodfill(thumbnail, (5,5), value=white)
 | 
			
		||||
    ImageDraw.floodfill(thumbnail, (5,355), value=white)
 | 
			
		||||
    """454-720 scales to 227-360"""
 | 
			
		||||
    scaled = image.resize((720, 360))
 | 
			
		||||
    # white = (255, 255, 255, 255)
 | 
			
		||||
    # ImageDraw.floodfill(scaled, (5, 5), value=white)
 | 
			
		||||
    # ImageDraw.floodfill(scaled, (5, 355), value=white)
 | 
			
		||||
    thumbnail = scaled.crop((0, 255, 719, 359))
 | 
			
		||||
    return thumbnail
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user