Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
S
stable-diffusion-webui
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
stable-diffusion-webui
Commits
980cd169
Commit
980cd169
authored
Sep 30, 2022
by
AUTOMATIC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prevent neural network resizing when it is not necessary #1109
parent
98cc6c6e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
images.py
modules/images.py
+10
-8
No files found.
modules/images.py
View file @
980cd169
...
@@ -213,17 +213,19 @@ def resize_image(resize_mode, im, width, height):
...
@@ -213,17 +213,19 @@ def resize_image(resize_mode, im, width, height):
if
opts
.
upscaler_for_img2img
is
None
or
opts
.
upscaler_for_img2img
==
"None"
or
im
.
mode
==
'L'
:
if
opts
.
upscaler_for_img2img
is
None
or
opts
.
upscaler_for_img2img
==
"None"
or
im
.
mode
==
'L'
:
return
im
.
resize
((
w
,
h
),
resample
=
LANCZOS
)
return
im
.
resize
((
w
,
h
),
resample
=
LANCZOS
)
scale
=
max
(
w
/
im
.
width
,
h
/
im
.
height
)
if
scale
>
1.0
:
upscalers
=
[
x
for
x
in
shared
.
sd_upscalers
if
x
.
name
==
opts
.
upscaler_for_img2img
]
upscalers
=
[
x
for
x
in
shared
.
sd_upscalers
if
x
.
name
==
opts
.
upscaler_for_img2img
]
assert
len
(
upscalers
)
>
0
,
f
"could not find upscaler named {opts.upscaler_for_img2img}"
assert
len
(
upscalers
)
>
0
,
f
"could not find upscaler named {opts.upscaler_for_img2img}"
upscaler
=
upscalers
[
0
]
upscaler
=
upscalers
[
0
]
scale
=
max
(
w
/
im
.
width
,
h
/
im
.
height
)
im
=
upscaler
.
scaler
.
upscale
(
im
,
scale
,
upscaler
.
data_path
)
upscaled
=
upscaler
.
scaler
.
upscale
(
im
,
scale
,
upscaler
.
data_path
)
if
upscaled
.
width
!=
w
or
upscaled
.
height
!=
h
:
if
im
.
width
!=
w
or
im
.
height
!=
h
:
upscaled
=
im
.
resize
((
w
,
h
),
resample
=
LANCZOS
)
im
=
im
.
resize
((
w
,
h
),
resample
=
LANCZOS
)
return
upscaled
return
im
if
resize_mode
==
0
:
if
resize_mode
==
0
:
res
=
resize
(
im
,
width
,
height
)
res
=
resize
(
im
,
width
,
height
)
...
...
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