@@ -85,8 +85,15 @@ def tell(self):
85
85
86
86
87
87
def _save_all (im , fp , filename ):
88
+ _save (im , fp , filename , save_all = True )
89
+
90
+
91
+ def _save (im , fp , filename , save_all = False ):
88
92
info = im .encoderinfo .copy ()
89
- append_images = list (info .get ("append_images" , []))
93
+ if save_all :
94
+ append_images = list (info .get ("append_images" , []))
95
+ else :
96
+ append_images = []
90
97
91
98
total = 0
92
99
for ims in [im ] + append_images :
@@ -186,6 +193,9 @@ def _save_all(im, fp, filename):
186
193
# Update frame index
187
194
frame_idx += 1
188
195
196
+ if not save_all :
197
+ break
198
+
189
199
finally :
190
200
im .seek (cur_idx )
191
201
@@ -199,7 +209,7 @@ def _save_all(im, fp, filename):
199
209
200
210
Image .register_open (AvifImageFile .format , AvifImageFile , _accept )
201
211
if SUPPORTED :
202
- Image .register_save (AvifImageFile .format , _save_all )
212
+ Image .register_save (AvifImageFile .format , _save )
203
213
Image .register_save_all (AvifImageFile .format , _save_all )
204
214
Image .register_extensions (AvifImageFile .format , [".avif" , ".avifs" ])
205
215
Image .register_mime (AvifImageFile .format , "image/avif" )
0 commit comments