added dropshadow without blur
This commit is contained in:
		
							parent
							
								
									1f38c89b3a
								
							
						
					
					
						commit
						2eb0e49eec
					
				
							
								
								
									
										15
									
								
								hcatitles.py
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								hcatitles.py
									
									
									
									
									
								
							| @ -10,6 +10,7 @@ def update_image(original, title, subtitle): | |||||||
|     renders text on full sized slide |     renders text on full sized slide | ||||||
|     make half sized copy for preview and fill top/bottom with white. |     make half sized copy for preview and fill top/bottom with white. | ||||||
|     """ |     """ | ||||||
|  |     # Render Text | ||||||
|     image = Image.new(mode="RGBA", size=(1280,720)) |     image = Image.new(mode="RGBA", size=(1280,720)) | ||||||
|     font1 = ImageFont.truetype('tahomabd.ttf', 50) |     font1 = ImageFont.truetype('tahomabd.ttf', 50) | ||||||
|     font2 = ImageFont.truetype('tahomabd.ttf', 38) |     font2 = ImageFont.truetype('tahomabd.ttf', 38) | ||||||
| @ -18,7 +19,19 @@ def update_image(original, title, subtitle): | |||||||
|               stroke_width=4, stroke_fill='black', spacing=4) |               stroke_width=4, stroke_fill='black', spacing=4) | ||||||
|     draw.text((20,588), subtitle, font=font2, fill='white', |     draw.text((20,588), subtitle, font=font2, fill='white', | ||||||
|               stroke_width=4, stroke_fill='black', spacing=4) |               stroke_width=4, stroke_fill='black', spacing=4) | ||||||
|     background = Image.alpha_composite(original, image) | 
 | ||||||
|  |     # Render Drop Shadow | ||||||
|  |     dropshadow = Image.new(mode="RGBA", size=(1280,720)) | ||||||
|  |     font1 = ImageFont.truetype('tahomabd.ttf', 50) | ||||||
|  |     font2 = ImageFont.truetype('tahomabd.ttf', 38) | ||||||
|  |     draw = ImageDraw.Draw(dropshadow) | ||||||
|  |     draw.text((25,525), title, font=font1, fill='black', | ||||||
|  |               stroke_width=4, stroke_fill='black', spacing=4) | ||||||
|  |     draw.text((25,593), subtitle, font=font2, fill='black', | ||||||
|  |               stroke_width=4, stroke_fill='black', spacing=4) | ||||||
|  | 
 | ||||||
|  |     background = Image.alpha_composite(original, dropshadow) | ||||||
|  |     background = Image.alpha_composite(background, image) | ||||||
|     return background |     return background | ||||||
| 
 | 
 | ||||||
| def update_thumbnail(image): | def update_thumbnail(image): | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user