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
3d2dbefc
Commit
3d2dbefc
authored
Jul 11, 2024
by
Andray
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix OSError: cannot write mode P as JPEG
parent
1da49079
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
modules/api/api.py
modules/api/api.py
+1
-1
modules/shared_state.py
modules/shared_state.py
+1
-1
No files found.
modules/api/api.py
View file @
3d2dbefc
...
@@ -113,7 +113,7 @@ def encode_pil_to_base64(image):
...
@@ -113,7 +113,7 @@ def encode_pil_to_base64(image):
image
.
save
(
output_bytes
,
format
=
"PNG"
,
pnginfo
=
(
metadata
if
use_metadata
else
None
),
quality
=
opts
.
jpeg_quality
)
image
.
save
(
output_bytes
,
format
=
"PNG"
,
pnginfo
=
(
metadata
if
use_metadata
else
None
),
quality
=
opts
.
jpeg_quality
)
elif
opts
.
samples_format
.
lower
()
in
(
"jpg"
,
"jpeg"
,
"webp"
):
elif
opts
.
samples_format
.
lower
()
in
(
"jpg"
,
"jpeg"
,
"webp"
):
if
image
.
mode
==
"RGBA"
:
if
image
.
mode
in
(
"RGBA"
,
"P"
)
:
image
=
image
.
convert
(
"RGB"
)
image
=
image
.
convert
(
"RGB"
)
parameters
=
image
.
info
.
get
(
'parameters'
,
None
)
parameters
=
image
.
info
.
get
(
'parameters'
,
None
)
exif_bytes
=
piexif
.
dump
({
exif_bytes
=
piexif
.
dump
({
...
...
modules/shared_state.py
View file @
3d2dbefc
...
@@ -162,7 +162,7 @@ class State:
...
@@ -162,7 +162,7 @@ class State:
errors
.
record_exception
()
errors
.
record_exception
()
def
assign_current_image
(
self
,
image
):
def
assign_current_image
(
self
,
image
):
if
shared
.
opts
.
live_previews_image_format
==
'jpeg'
and
image
.
mode
==
'RGBA'
:
if
shared
.
opts
.
live_previews_image_format
==
'jpeg'
and
image
.
mode
in
(
'RGBA'
,
'P'
)
:
image
=
image
.
convert
(
'RGB'
)
image
=
image
.
convert
(
'RGB'
)
self
.
current_image
=
image
self
.
current_image
=
image
self
.
id_live_preview
+=
1
self
.
id_live_preview
+=
1
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