@@ -108,7 +108,6 @@ def prepare_frames(self):
108
108
offset = extract_name (frame ).replace ("-" , ":" ).split ("." )[0 ]
109
109
progress .update ("Processing [bold]%s[/bold] frame" % offset )
110
110
with Image .open (frame ) as image :
111
- image = image .resize ((self .width , self .height ), Image .ANTIALIAS )
112
111
master .paste (image , (x , y ))
113
112
114
113
with Progress ("Saving the result at '%s'" % master_path ):
@@ -124,9 +123,8 @@ def format_time(secs):
124
123
route = os .path .join (prefix , extract_name (self .filepath ) + ".png" )
125
124
route = pathlib .Path (route ).as_posix ()
126
125
127
- with Progress ("Saving thumbnail metadata at '%s'" % self .metadata_path ) as progress :
126
+ with Progress ("Saving thumbnail metadata at '%s'" % self .metadata_path ):
128
127
for _ , start , end , x , y in self .thumbnails ():
129
- progress .update ("Generating metadata for '%s'" % route )
130
128
thumbnail_data = "%s --> %s\n %s#xywh=%d,%d,%d,%d\n \n " % (
131
129
format_time (start ), format_time (end ),
132
130
route , x , y , self .width , self .height ,
@@ -148,17 +146,17 @@ def calc_thumbnail_dir(self):
148
146
return ensure_tree (os .path .join (basedir , extract_name (self .filepath )), True )
149
147
150
148
def prepare_frames (self ):
151
- if os .path .exists (self .thumbnail_dir ):
152
- remove_tree (self .thumbnail_dir )
153
- copy_tree (self .tempdir .name , self .thumbnail_dir )
149
+ with Progress ("Copying the frames to the output directory" ):
150
+ if os .path .exists (self .thumbnail_dir ):
151
+ remove_tree (self .thumbnail_dir )
152
+ copy_tree (self .tempdir .name , self .thumbnail_dir )
154
153
155
154
def generate (self ):
156
155
metadata = {}
157
156
158
- for frame , start , * _ in self .thumbnails ():
159
- frame = os .path .join (self .thumbnail_dir , os .path .basename (frame ))
160
- with Image .open (frame ) as image :
161
- image .resize ((self .width , self .height ), Image .ANTIALIAS ).save (frame )
157
+ with Progress ("Saving thumbnail metadata at '%s'" % self .metadata_path ):
158
+ for frame , start , * _ in self .thumbnails ():
159
+ frame = os .path .join (self .thumbnail_dir , os .path .basename (frame ))
162
160
base = os .path .join (self .base , os .path .basename (self .thumbnail_dir ))
163
161
prefix = base if self .base else os .path .relpath (self .thumbnail_dir )
164
162
route = os .path .join (prefix , os .path .basename (frame ))
0 commit comments