Greyscale
This commit is contained in:
		
							parent
							
								
									f286b23f6a
								
							
						
					
					
						commit
						77a4727cc0
					
				| @ -6,7 +6,7 @@ from pathlib import Path | ||||
| from threading import Thread | ||||
| 
 | ||||
| import yaml | ||||
| from PIL import Image | ||||
| from PIL import Image, ImageOps | ||||
| 
 | ||||
| 
 | ||||
| class ScreenshotManager: | ||||
| @ -29,10 +29,14 @@ class ScreenshotManager: | ||||
|         self.__loop_thread = Thread(target=self.__loop) | ||||
|         self.__loop_thread.start() | ||||
| 
 | ||||
|     def __rotate_file(self, filename): | ||||
|     def __process_image(self, ss): | ||||
|         filename = ss.get("output") | ||||
|         fp = Path(self.data_path, filename) | ||||
|         img = Image.open(fp) | ||||
|         img = img.rotate(90, expand=True) | ||||
|         img = ImageOps.grayscale(Image.open(fp)) | ||||
| 
 | ||||
|         if ss.get("rotate", False) is True: | ||||
|             img = img.rotate(90, expand=True) | ||||
| 
 | ||||
|         img.save(fp) | ||||
| 
 | ||||
|     def __loop(self): | ||||
| @ -43,8 +47,7 @@ class ScreenshotManager: | ||||
|                     ["shot-scraper", "multi", self.__config_path], cwd=self.data_path | ||||
|                 ) | ||||
|                 for ss in self.__config_yaml: | ||||
|                     if ss.get("rotate", False) is True: | ||||
|                         self.__rotate_file(ss.get("output")) | ||||
|                     self.__process_image(ss) | ||||
| 
 | ||||
|             time.sleep(1) | ||||
|             counter += 1 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user