File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed
Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -180,21 +180,18 @@ def _save(
180180 autotiling = bool (info .get ("autotiling" , tile_rows_log2 == tile_cols_log2 == 0 ))
181181
182182 icc_profile = info .get ("icc_profile" , im .info .get ("icc_profile" ))
183+ exif_orientation = 1
183184 if exif := info .get ("exif" ):
184185 if isinstance (exif , Image .Exif ):
185186 exif_data = exif
186- exif = exif .tobytes ()
187187 else :
188188 exif_data = Image .Exif ()
189189 exif_data .load (exif )
190- exif_orientation = exif_data .pop (ExifTags .Base .Orientation , 0 )
191- if exif_orientation != 0 :
192- if len (exif_data ):
193- exif = exif_data .tobytes ()
194- else :
195- exif = None
196- else :
197- exif_orientation = 0
190+ if ExifTags .Base .Orientation in exif_data :
191+ exif_orientation = exif_data .pop (ExifTags .Base .Orientation )
192+ exif = exif_data .tobytes () if exif_data else b""
193+ elif isinstance (exif , Image .Exif ):
194+ exif = exif_data .tobytes ()
198195
199196 xmp = info .get ("xmp" )
200197
You can’t perform that action at this time.
0 commit comments