File tree Expand file tree Collapse file tree 2 files changed +7
-16
lines changed Expand file tree Collapse file tree 2 files changed +7
-16
lines changed Original file line number Diff line number Diff line change @@ -1404,15 +1404,9 @@ def getexif(self):
14041404 if 0x0112 not in self ._exif :
14051405 xmp_tags = self .info .get ("XML:com.adobe.xmp" )
14061406 if xmp_tags :
1407- match = re .search (r'tiff:Orientation=" ([0-9])" ' , xmp_tags )
1407+ match = re .search (r'tiff:Orientation(="|>) ([0-9])' , xmp_tags )
14081408 if match :
1409- self ._exif [0x0112 ] = int (match [1 ])
1410- else :
1411- match = re .search (
1412- r"<tiff:Orientation>([0-9])</tiff:Orientation>" , xmp_tags
1413- )
1414- if match :
1415- self ._exif [0x0112 ] = int (match [1 ])
1409+ self ._exif [0x0112 ] = int (match [2 ])
14161410
14171411 return self ._exif
14181412
Original file line number Diff line number Diff line change @@ -601,15 +601,12 @@ def exif_transpose(image):
601601 "Raw profile type exif"
602602 ] = transposed_exif .tobytes ().hex ()
603603 elif "XML:com.adobe.xmp" in transposed_image .info :
604- transposed_image . info [ "XML:com.adobe.xmp" ] = re . sub (
604+ for pattern in (
605605 r'tiff:Orientation="([0-9])"' ,
606- "" ,
607- transposed_image .info ["XML:com.adobe.xmp" ],
608- )
609- transposed_image .info ["XML:com.adobe.xmp" ] = re .sub (
610606 r"<tiff:Orientation>([0-9])</tiff:Orientation>" ,
611- "" ,
612- transposed_image .info ["XML:com.adobe.xmp" ],
613- )
607+ ):
608+ transposed_image .info ["XML:com.adobe.xmp" ] = re .sub (
609+ pattern , "" , transposed_image .info ["XML:com.adobe.xmp" ]
610+ )
614611 return transposed_image
615612 return image .copy ()
You can’t perform that action at this time.
0 commit comments