mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-10-30 23:47:27 +03:00 
			
		
		
		
	Merge pull request #6124 from radarhere/exif
This commit is contained in:
		
						commit
						3cce863ec8
					
				|  | @ -666,6 +666,19 @@ class TestImage: | ||||||
| 
 | 
 | ||||||
|             assert not fp.closed |             assert not fp.closed | ||||||
| 
 | 
 | ||||||
|  |     def test_empty_exif(self): | ||||||
|  |         with Image.open("Tests/images/exif.png") as im: | ||||||
|  |             exif = im.getexif() | ||||||
|  |         assert dict(exif) != {} | ||||||
|  | 
 | ||||||
|  |         # Test that exif data is cleared after another load | ||||||
|  |         exif.load(None) | ||||||
|  |         assert dict(exif) == {} | ||||||
|  | 
 | ||||||
|  |         # Test loading just the EXIF header | ||||||
|  |         exif.load(b"Exif\x00\x00") | ||||||
|  |         assert dict(exif) == {} | ||||||
|  | 
 | ||||||
|     @mark_if_feature_version( |     @mark_if_feature_version( | ||||||
|         pytest.mark.valgrind_known_error, "libjpeg_turbo", "2.0", reason="Known Failing" |         pytest.mark.valgrind_known_error, "libjpeg_turbo", "2.0", reason="Known Failing" | ||||||
|     ) |     ) | ||||||
|  |  | ||||||
|  | @ -3485,12 +3485,12 @@ class Exif(MutableMapping): | ||||||
|         self._loaded_exif = data |         self._loaded_exif = data | ||||||
|         self._data.clear() |         self._data.clear() | ||||||
|         self._ifds.clear() |         self._ifds.clear() | ||||||
|  |         if data and data.startswith(b"Exif\x00\x00"): | ||||||
|  |             data = data[6:] | ||||||
|         if not data: |         if not data: | ||||||
|             self._info = None |             self._info = None | ||||||
|             return |             return | ||||||
| 
 | 
 | ||||||
|         if data.startswith(b"Exif\x00\x00"): |  | ||||||
|             data = data[6:] |  | ||||||
|         self.fp = io.BytesIO(data) |         self.fp = io.BytesIO(data) | ||||||
|         self.head = self.fp.read(8) |         self.head = self.fp.read(8) | ||||||
|         # process dictionary |         # process dictionary | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user