mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 01:47:47 +03:00 
			
		
		
		
	Replaced xml.etree.ElementTree with re
This commit is contained in:
		
							parent
							
								
									4b4e5f0e2c
								
							
						
					
					
						commit
						41b58f4b16
					
				| 
						 | 
					@ -31,6 +31,7 @@ import logging
 | 
				
			||||||
import math
 | 
					import math
 | 
				
			||||||
import numbers
 | 
					import numbers
 | 
				
			||||||
import os
 | 
					import os
 | 
				
			||||||
 | 
					import re
 | 
				
			||||||
import struct
 | 
					import struct
 | 
				
			||||||
import sys
 | 
					import sys
 | 
				
			||||||
import tempfile
 | 
					import tempfile
 | 
				
			||||||
| 
						 | 
					@ -1381,15 +1382,9 @@ class Image:
 | 
				
			||||||
        if 0x0112 not in self._exif:
 | 
					        if 0x0112 not in self._exif:
 | 
				
			||||||
            xmp_tags = self.info.get("XML:com.adobe.xmp")
 | 
					            xmp_tags = self.info.get("XML:com.adobe.xmp")
 | 
				
			||||||
            if xmp_tags:
 | 
					            if xmp_tags:
 | 
				
			||||||
                xmp = self._getxmp(xmp_tags)
 | 
					                match = re.search(r'tiff:Orientation="([0-9])"', xmp_tags)
 | 
				
			||||||
                if (
 | 
					                if match:
 | 
				
			||||||
                    "xmpmeta" in xmp
 | 
					                    self._exif[0x0112] = int(match[1])
 | 
				
			||||||
                    and "RDF" in xmp["xmpmeta"]
 | 
					 | 
				
			||||||
                    and "Description" in xmp["xmpmeta"]["RDF"]
 | 
					 | 
				
			||||||
                ):
 | 
					 | 
				
			||||||
                    description = xmp["xmpmeta"]["RDF"]["Description"]
 | 
					 | 
				
			||||||
                    if "Orientation" in description:
 | 
					 | 
				
			||||||
                        self._exif[0x0112] = int(description["Orientation"])
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return self._exif
 | 
					        return self._exif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user