Skip to content

Commit

Permalink
Fix saving images from gallery
Browse files Browse the repository at this point in the history
  • Loading branch information
missionfloyd committed Dec 18, 2023
1 parent eb41c73 commit af71f64
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules/ui_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import gradio as gr
import subprocess as sp
from PIL import Image

from modules import call_queue, shared
from modules.generation_parameters_copypaste import image_from_url_text
Expand Down Expand Up @@ -55,6 +56,7 @@ def __init__(self, d=None):
extension: str = shared.opts.samples_format
start_index = 0
only_one = False
images = [x.image.path for x in images.root]

if index > -1 and shared.opts.save_selected_only and (index >= data["index_of_first_image"]): # ensures we are looking at a specific non-grid picture, and we have save_selected_only
only_one = True
Expand All @@ -70,7 +72,7 @@ def __init__(self, d=None):
writer.writerow(["prompt", "seed", "width", "height", "sampler", "cfgs", "steps", "filename", "negative_prompt"])

for image_index, filedata in enumerate(images, start_index):
image = image_from_url_text(filedata)
image = Image.open(filedata)

is_grid = image_index < p.index_of_first_image
i = 0 if is_grid else (image_index - p.index_of_first_image)
Expand Down

0 comments on commit af71f64

Please sign in to comment.