File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -102,8 +102,9 @@ class PillowStep(Step):
102
102
"""
103
103
A simple Pillow step which can convert and/or thumbnail images.
104
104
"""
105
- def __init__ (self , thumbnail : tuple [int , int ] | None = None ):
105
+ def __init__ (self , thumbnail : tuple [int , int ] | None = None , transpose : bool = True ):
106
106
self .thumbnail = thumbnail
107
+ self .transpose = transpose
107
108
108
109
@classmethod
109
110
def get_dependencies (cls ):
@@ -112,13 +113,15 @@ def get_dependencies(cls):
112
113
}
113
114
114
115
def __call__ (self , path : Path , output_paths : list [Path ]):
115
- from PIL import Image
116
+ from PIL import Image , ImageOps
116
117
117
118
groups = {}
118
119
for target_path in output_paths :
119
120
groups .setdefault (target_path .suffix , []).append (target_path )
120
121
121
122
with Image .open (path ) as img :
123
+ if self .transpose :
124
+ ImageOps .exif_transpose (img , in_place = True )
122
125
if self .thumbnail :
123
126
img .thumbnail (self .thumbnail )
124
127
You can’t perform that action at this time.
0 commit comments