mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 09:57:43 +03:00 
			
		
		
		
	Use BytesIO instead of StringIO
This commit is contained in:
		
							parent
							
								
									c768e793a4
								
							
						
					
					
						commit
						b9b6972097
					
				| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
from PIL import Image
 | 
					from PIL import Image
 | 
				
			||||||
from PIL import ImageFile
 | 
					from PIL import ImageFile
 | 
				
			||||||
import StringIO
 | 
					from io import BytesIO
 | 
				
			||||||
import _webp
 | 
					import _webp
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def _accept(prefix):
 | 
					def _accept(prefix):
 | 
				
			||||||
| 
						 | 
					@ -15,7 +15,7 @@ class WebPImageFile(ImageFile.ImageFile):
 | 
				
			||||||
        self.mode = "RGB"
 | 
					        self.mode = "RGB"
 | 
				
			||||||
        data, width, height = _webp.WebPDecodeRGB(self.fp.read())
 | 
					        data, width, height = _webp.WebPDecodeRGB(self.fp.read())
 | 
				
			||||||
        self.size = width, height
 | 
					        self.size = width, height
 | 
				
			||||||
        self.fp = StringIO.StringIO(data)
 | 
					        self.fp = BytesIO(data)
 | 
				
			||||||
        self.tile = [("raw", (0, 0) + self.size, 0, 'RGB')]
 | 
					        self.tile = [("raw", (0, 0) + self.size, 0, 'RGB')]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def _save(im, fp, filename):
 | 
					def _save(im, fp, filename):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user