Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
ComfyUI
Commits
6cc45057
Commit
6cc45057
authored
May 22, 2023
by
comfyanonymous
Browse files
Auto transpose images from exif data.
parent
dc198650
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
comfy/k_diffusion/sampling.py
comfy/k_diffusion/sampling.py
+1
-1
nodes.py
nodes.py
+3
-1
No files found.
comfy/k_diffusion/sampling.py
View file @
6cc45057
...
@@ -620,6 +620,7 @@ def sample_dpmpp_2m_sde(model, x, sigmas, extra_args=None, callback=None, disabl
...
@@ -620,6 +620,7 @@ def sample_dpmpp_2m_sde(model, x, sigmas, extra_args=None, callback=None, disabl
old_denoised
=
None
old_denoised
=
None
h_last
=
None
h_last
=
None
h
=
None
for
i
in
trange
(
len
(
sigmas
)
-
1
,
disable
=
disable
):
for
i
in
trange
(
len
(
sigmas
)
-
1
,
disable
=
disable
):
denoised
=
model
(
x
,
sigmas
[
i
]
*
s_in
,
**
extra_args
)
denoised
=
model
(
x
,
sigmas
[
i
]
*
s_in
,
**
extra_args
)
...
@@ -628,7 +629,6 @@ def sample_dpmpp_2m_sde(model, x, sigmas, extra_args=None, callback=None, disabl
...
@@ -628,7 +629,6 @@ def sample_dpmpp_2m_sde(model, x, sigmas, extra_args=None, callback=None, disabl
if
sigmas
[
i
+
1
]
==
0
:
if
sigmas
[
i
+
1
]
==
0
:
# Denoising step
# Denoising step
x
=
denoised
x
=
denoised
h
=
None
else
:
else
:
# DPM-Solver++(2M) SDE
# DPM-Solver++(2M) SDE
t
,
s
=
-
sigmas
[
i
].
log
(),
-
sigmas
[
i
+
1
].
log
()
t
,
s
=
-
sigmas
[
i
].
log
(),
-
sigmas
[
i
+
1
].
log
()
...
...
nodes.py
View file @
6cc45057
...
@@ -8,7 +8,7 @@ import traceback
...
@@ -8,7 +8,7 @@ import traceback
import
math
import
math
import
time
import
time
from
PIL
import
Image
from
PIL
import
Image
,
ImageOps
from
PIL.PngImagePlugin
import
PngInfo
from
PIL.PngImagePlugin
import
PngInfo
import
numpy
as
np
import
numpy
as
np
import
safetensors.torch
import
safetensors.torch
...
@@ -1057,6 +1057,7 @@ class LoadImage:
...
@@ -1057,6 +1057,7 @@ class LoadImage:
def
load_image
(
self
,
image
):
def
load_image
(
self
,
image
):
image_path
=
folder_paths
.
get_annotated_filepath
(
image
)
image_path
=
folder_paths
.
get_annotated_filepath
(
image
)
i
=
Image
.
open
(
image_path
)
i
=
Image
.
open
(
image_path
)
i
=
ImageOps
.
exif_transpose
(
i
)
image
=
i
.
convert
(
"RGB"
)
image
=
i
.
convert
(
"RGB"
)
image
=
np
.
array
(
image
).
astype
(
np
.
float32
)
/
255.0
image
=
np
.
array
(
image
).
astype
(
np
.
float32
)
/
255.0
image
=
torch
.
from_numpy
(
image
)[
None
,]
image
=
torch
.
from_numpy
(
image
)[
None
,]
...
@@ -1100,6 +1101,7 @@ class LoadImageMask:
...
@@ -1100,6 +1101,7 @@ class LoadImageMask:
def
load_image
(
self
,
image
,
channel
):
def
load_image
(
self
,
image
,
channel
):
image_path
=
folder_paths
.
get_annotated_filepath
(
image
)
image_path
=
folder_paths
.
get_annotated_filepath
(
image
)
i
=
Image
.
open
(
image_path
)
i
=
Image
.
open
(
image_path
)
i
=
ImageOps
.
exif_transpose
(
i
)
if
i
.
getbands
()
!=
(
"R"
,
"G"
,
"B"
,
"A"
):
if
i
.
getbands
()
!=
(
"R"
,
"G"
,
"B"
,
"A"
):
i
=
i
.
convert
(
"RGBA"
)
i
=
i
.
convert
(
"RGBA"
)
mask
=
None
mask
=
None
...
...
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