@@ -193,7 +193,7 @@ def processed_inject_image(image, info_index, iteration: int, save_path_override
193193 if p .n_iter > 1 : # if splitting by batch count
194194 num_remote_images *= p .n_iter - 1
195195 total_images = num_remote_images + images_per_batch
196- info_text_used_seed_index = info_index + p .n_iter * p .batch_size
196+ info_text_used_seed_index = info_index + p .n_iter * p .batch_size if not grid else 0
197197
198198 if iteration != 0 :
199199 logger .debug (f"iteration { iteration } /{ p .n_iter } , image { true_image_pos + 1 } /{ total_images } , info-index: { info_index } , used seed index { info_text_used_seed_index } " )
@@ -204,9 +204,8 @@ def processed_inject_image(image, info_index, iteration: int, save_path_override
204204 all_seeds = processed .all_seeds ,
205205 all_subseeds = processed .all_subseeds ,
206206 # comments=[""], # unimplemented upstream :(
207- # we don't need the "true_image_pos" like below with save_image because this method does it for us
208- position_in_batch = true_image_pos ,
209- iteration = 0 # if batch count is 2 p.n_iter will be 2
207+ position_in_batch = true_image_pos if not grid else 0 ,
208+ iteration = 0
210209 )
211210 processed .infotexts .append (info_text )
212211
@@ -265,8 +264,9 @@ def processed_inject_image(image, info_index, iteration: int, save_path_override
265264 injected_to_iteration += 1
266265
267266 # generate and inject grid
268- # grid = processing.images.image_grid(processed.images, len(processed.images))
269- # processed_inject_image(image=grid, info_index=0, save_path_override=p.outpath_grids, iteration=0, grid=True)
267+ if opts .return_grid :
268+ grid = processing .images .image_grid (processed .images , len (processed .images ))
269+ processed_inject_image (image = grid , info_index = 0 , save_path_override = p .outpath_grids , iteration = spoofed_iteration , grid = True )
270270
271271 p .batch_size = len (processed .images )
272272 """
0 commit comments