mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-10-31 07:57:27 +03:00 
			
		
		
		
	If image is already in the destination mode and there is no matrix, do not convert
This commit is contained in:
		
							parent
							
								
									411765a69c
								
							
						
					
					
						commit
						d8c088ed8b
					
				
							
								
								
									
										18
									
								
								PIL/Image.py
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								PIL/Image.py
									
									
									
									
									
								
							|  | @ -871,18 +871,16 @@ class Image(object): | |||
|         :returns: An :py:class:`~PIL.Image.Image` object. | ||||
|         """ | ||||
| 
 | ||||
|         if not mode: | ||||
|         self.load() | ||||
| 
 | ||||
|         if not mode and self.mode == "P": | ||||
|             # determine default mode | ||||
|             if self.mode == "P": | ||||
|                 self.load() | ||||
|                 if self.palette: | ||||
|                     mode = self.palette.mode | ||||
|                 else: | ||||
|                     mode = "RGB" | ||||
|             if self.palette: | ||||
|                 mode = self.palette.mode | ||||
|             else: | ||||
|                 return self.copy() | ||||
|         else: | ||||
|             self.load() | ||||
|                 mode = "RGB" | ||||
|         if not mode or (mode == self.mode and not matrix): | ||||
|             return self.copy() | ||||
| 
 | ||||
|         if matrix: | ||||
|             # matrix conversion | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user