mirror of
https://github.com/vladmandic/automatic
synced 2026-09-18 16:54:33 +02:00
fix save metadata
This commit is contained in:
+2
-1
@@ -351,7 +351,8 @@ class FilenameGenerator:
|
||||
buffered = BytesIO()
|
||||
self.image.save(buffered, format="JPEG")
|
||||
img_str = base64.b64encode(buffered.getvalue())
|
||||
return hashlib.sha256(img_str).hexdigest()[0:8]
|
||||
shorthash = hashlib.sha256(img_str).hexdigest()[0:8]
|
||||
return shorthash
|
||||
|
||||
def prompt_no_style(self):
|
||||
if self.p is None or self.prompt is None:
|
||||
|
||||
@@ -1083,7 +1083,7 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
|
||||
for img in self.init_images:
|
||||
# Save init image
|
||||
if shared.opts.save_init_img:
|
||||
self.init_img_hash = hashlib.md5(img.tobytes()).hexdigest() # pylint: disable=attribute-defined-outside-init
|
||||
self.init_img_hash = hashlib.sha256(img.tobytes()).hexdigest()[0:8] # pylint: disable=attribute-defined-outside-init
|
||||
images.save_image(img, path=shared.opts.outdir_init_images, basename=None, forced_filename=self.init_img_hash, save_to_dirs=False)
|
||||
image = images.flatten(img, shared.opts.img2img_background_color)
|
||||
if crop_region is None and self.resize_mode != 4:
|
||||
|
||||
@@ -119,8 +119,8 @@ def save_files(js_data, images, html_info, index):
|
||||
shared.log.info(f"Copying image: {fullfn} -> {destination}")
|
||||
else:
|
||||
image = image_from_url_text(filedata)
|
||||
# infotext is offset by 1 because the first image is the grid
|
||||
fullfn, txt_fullfn = modules.images.save_image(image, shared.opts.outdir_save, "", seed=p.all_seeds[i], prompt=p.all_prompts[i], info=p.infotexts[i + 1], extension=shared.opts.samples_format, grid=is_grid, p=p, save_to_dirs=shared.opts.use_save_to_dirs_for_ui)
|
||||
info = p.infotexts[i + 1] if len(p.infotexts) > len(p.all_seeds) else p.infotexts[i] # infotexts may be offset by 1 because the first image is the grid
|
||||
fullfn, txt_fullfn = modules.images.save_image(image, shared.opts.outdir_save, "", seed=p.all_seeds[i], prompt=p.all_prompts[i], info=info, extension=shared.opts.samples_format, grid=is_grid, p=p, save_to_dirs=shared.opts.use_save_to_dirs_for_ui)
|
||||
if fullfn is None:
|
||||
continue
|
||||
filename = os.path.relpath(fullfn, shared.opts.outdir_save)
|
||||
|
||||
Reference in New Issue
Block a user