mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 09:57:43 +03:00 
			
		
		
		
	add support of python 3's bytearray
This commit is contained in:
		
							parent
							
								
									a422a28bb7
								
							
						
					
					
						commit
						1ba6ff8a33
					
				| 
						 | 
					@ -26,6 +26,7 @@ from . import Image, ImageFile
 | 
				
			||||||
from ._binary import i8, o8, i16be as i16, o16be as o16
 | 
					from ._binary import i8, o8, i16be as i16, o16be as o16
 | 
				
			||||||
import struct
 | 
					import struct
 | 
				
			||||||
import os
 | 
					import os
 | 
				
			||||||
 | 
					import sys
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
__version__ = "0.3"
 | 
					__version__ = "0.3"
 | 
				
			||||||
| 
						 | 
					@ -217,6 +218,9 @@ class SGI16Decoder(ImageFile.PyDecoder):
 | 
				
			||||||
                          y * stride + z * pagesize) * 2
 | 
					                          y * stride + z * pagesize) * 2
 | 
				
			||||||
                    pixel = i16(s, o=bi)
 | 
					                    pixel = i16(s, o=bi)
 | 
				
			||||||
                    pixel = int(pixel // 256)
 | 
					                    pixel = int(pixel // 256)
 | 
				
			||||||
 | 
					                    if sys.version_info.major == 3:
 | 
				
			||||||
 | 
					                        data[i] = pixel
 | 
				
			||||||
 | 
					                    else:
 | 
				
			||||||
                        data[i] = o8(pixel)
 | 
					                        data[i] = o8(pixel)
 | 
				
			||||||
                    i += 1
 | 
					                    i += 1
 | 
				
			||||||
            y += orientation
 | 
					            y += orientation
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user