fix save text file for manually saved images

This commit is contained in:
Vladimir Mandic
2023-11-27 08:07:12 -05:00
parent 6d11fdf695
commit 49f8730814
4 changed files with 31 additions and 17 deletions
+18 -15
View File
@@ -1,31 +1,34 @@
# Change Log for SD.Next
## Update for 2023-11-24
## Update for 2023-11-26
Note: Release pending `diffusers==0.24`
- **Diffusers**
- **IP adapter**
- Lightweight implementation of T2I adapters which can guide generation towards specific image style
- Supports most T2I models, not limited to SD
- Lightweight implementation of T2I adapters which can guide generation towards specific image style
- Supports most T2I models, not limited to SD
- **HDR latent control**, based on [article](https://huggingface.co/blog/TimothyAlexisVass/explaining-the-sdxl-latent-space#long-prompts-at-high-guidance-scales-becoming-possible)
- In *Advanced* params
- Allows control of *latent clamping*, *color centering* and *range maximimization*
- Supported by *XYZ grid*
- Allows control of *latent clamping*, *color centering* and *range maximimization*
- Supported by *XYZ grid*
- **Kandinsky 3** support
- download using built-in model downloader or simply select from networks -> reference
- this model is absolutely massive at 27.5GB at fp16, so be patient
- this model is absolutely massive at 27.5GB at fp16, so be patient
- model params count is at 11.9B (compared to SD-XL at 3.3B) and its trained on mixed resolutions from 256px to 1024px
- use either model offload or sequential cpu offload to be able to use it
- better autodetection of *inpaint* and *instruct* pipelines
- support long seconary prompt for refiner
- use either model offload or sequential cpu offload to be able to use it
- better autodetection of *inpaint* and *instruct* pipelines
- support long seconary prompt for refiner
- **Model merge**
- add sd-xl rebasin support, thanks @AI-Casanova
- **General**
- log level defaults to info for console and debug for log file
- better prompt display in process tab
- increase maximum lora cache values
- fix controlnet compatibility issues in original backend
- fix python 3.9 compatibility issues
- fix img2img/inpaint paste params
- log level defaults to info for console and debug for log file
- better prompt display in process tab
- increase maximum lora cache values
- fix controlnet compatibility issues in original backend
- fix img2img/inpaint paste params
- fix save text file for manually saved images
- fix python 3.9 compatibility issues
## Update for 2023-11-23
+1 -1
View File
@@ -445,7 +445,7 @@
{"id":"","label":"File format for grids","localized":"","hint":""},
{"id":"","label":"Add extended info (seed, prompt) to filename when saving grid","localized":"","hint":""},
{"id":"","label":"Grid row count","localized":"","hint":"Use -1 for autodetect and 0 for it to be same as batch size"},
{"id":"","label":"Create text file next to every image with generation parameters","localized":"","hint":""},
{"id":"","label":"Create info file for each every image","localized":"","hint":""},
{"id":"","label":"Create JSON log file for each saved image","localized":"","hint":"Save image information to a JSON file"},
{"id":"","label":"Save copy of image before doing face restoration","localized":"","hint":""},
{"id":"","label":"Save copy of image before applying hires","localized":"","hint":""},
+1 -1
View File
@@ -411,7 +411,7 @@ options_templates.update(options_section(('saving-images', "Image Options"), {
"image_sep_metadata": OptionInfo("<h2>Metadata/Logging</h2>", "", gr.HTML),
"image_metadata": OptionInfo(True, "Include metadata in saved images"),
"save_txt": OptionInfo(False, "Create text file next to every image with generation parameters"),
"save_txt": OptionInfo(False, "Create info file for each every image"),
"save_log_fn": OptionInfo("", "Create JSON log file for each saved image", component_args=hide_dirs),
"image_watermark_enabled": OptionInfo(False, "Include watermark in saved images"),
"image_watermark": OptionInfo('', "Image watermark string"),
+11
View File
@@ -134,6 +134,17 @@ def save_files(js_data, images, html_info, index):
shutil.copy(fullfn, destination)
shared.log.info(f'Copying image: file="{fullfn}" folder="{destination}"')
tgt_filename = os.path.join(destination, os.path.basename(fullfn))
if shared.opts.save_txt:
try:
from PIL import Image
image = Image.open(fullfn)
info, _ = images.read_info_from_image(image)
filename_txt = f"{os.path.splitext(tgt_filename)[0]}.txt"
with open(filename_txt, "w", encoding="utf8") as file:
file.write(f"{info}\n")
shared.log.debug(f'Saving: text="{filename_txt}"')
except Exception as e:
shared.log.warning(f'Image description save failed: {filename_txt} {e}')
modules.script_callbacks.image_save_btn_callback(tgt_filename)
else:
image = image_from_url_text(filedata)