mirror of
				https://github.com/zulip/zulip.git
				synced 2025-10-31 03:53:50 +00:00 
			
		
		
		
	uploads: Convert CMYK to RGB when saving avatar/realm icon as png.
Fixes #8546. PNG does not support CMYK mode. CMYK file is converted to RGB and then saved as PNG.
This commit is contained in:
		
				
					committed by
					
						 Tim Abbott
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							92ba40b0c7
						
					
				
				
					commit
					13664f1289
				
			| @@ -88,6 +88,8 @@ def resize_avatar(image_data: bytes, size: int=DEFAULT_AVATAR_SIZE) -> bytes: | ||||
|     except IOError: | ||||
|         raise BadImageError("Could not decode image; did you upload an image file?") | ||||
|     out = io.BytesIO() | ||||
|     if im.mode == 'CMYK': | ||||
|         im = im.convert('RGB') | ||||
|     im.save(out, format='png') | ||||
|     return out.getvalue() | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user