Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stable Diffusion Webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Stable Diffusion Webui
Commits
19772c3c
Commit
19772c3c
authored
Jul 08, 2023
by
AUTOMATIC1111
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix problem with extra network saving images as previews losing generation info
add a description for save_image_with_geninfo
parent
16045d08
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
modules/images.py
modules/images.py
+12
-2
No files found.
modules/images.py
View file @
19772c3c
...
...
@@ -497,13 +497,23 @@ def get_next_sequence_number(path, basename):
return
result
+
1
def
save_image_with_geninfo
(
image
,
geninfo
,
filename
,
extension
=
None
,
existing_pnginfo
=
None
):
def
save_image_with_geninfo
(
image
,
geninfo
,
filename
,
extension
=
None
,
existing_pnginfo
=
None
,
pnginfo_section_name
=
'parameters'
):
"""
Saves image to filename, including geninfo as text information for generation info.
For PNG images, geninfo is added to existing pnginfo dictionary using the pnginfo_section_name argument as key.
For JPG images, there's no dictionary and geninfo just replaces the EXIF description.
"""
if
extension
is
None
:
extension
=
os
.
path
.
splitext
(
filename
)[
1
]
image_format
=
Image
.
registered_extensions
()[
extension
]
if
extension
.
lower
()
==
'.png'
:
existing_pnginfo
=
existing_pnginfo
or
{}
if
opts
.
enable_pnginfo
:
existing_pnginfo
[
pnginfo_section_name
]
=
geninfo
if
opts
.
enable_pnginfo
:
pnginfo_data
=
PngImagePlugin
.
PngInfo
()
for
k
,
v
in
(
existing_pnginfo
or
{})
.
items
():
...
...
@@ -622,7 +632,7 @@ def save_image(image, path, basename, seed=None, prompt=None, extension='png', i
"""
temp_file_path
=
f
"{filename_without_extension}.tmp"
save_image_with_geninfo
(
image_to_save
,
info
,
temp_file_path
,
extension
,
params
.
pnginfo
)
save_image_with_geninfo
(
image_to_save
,
info
,
temp_file_path
,
extension
,
existing_pnginfo
=
params
.
pnginfo
,
pnginfo_section_name
=
pnginfo_section_name
)
os
.
replace
(
temp_file_path
,
filename_without_extension
+
extension
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment