mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-27 09:27:24 +08:00
Compare commits
7 Commits
87994368cc
...
0e3c8c07c3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0e3c8c07c3 | ||
|
|
f10bb1e780 | ||
|
|
59075cf255 | ||
|
|
15f993a036 | ||
|
|
e996b817cd | ||
|
|
632771d988 | ||
|
|
87514354a5 |
@ -38,7 +38,8 @@ class ConvertColorSpace(IO.ComfyNode):
|
||||
@classmethod
|
||||
def define_schema(cls):
|
||||
return IO.Schema(
|
||||
node_id="Convert Color Space",
|
||||
node_id="ConvertColorSpace",
|
||||
display_name="Convert Color Space",
|
||||
category="image/color",
|
||||
inputs=[
|
||||
IO.Image.Input("images"),
|
||||
@ -71,7 +72,7 @@ class ConvertColorSpace(IO.ComfyNode):
|
||||
|
||||
elif source_color_space == "HDR Display (PQ/Rec.2020)":
|
||||
# assuming Linear Rec.2020 input. Convert to Linear Rec.709
|
||||
matrix = M_2020_to_709.to(device)
|
||||
matrix = M_2020_to_709.to(device=device, dtype=rgb.dtype)
|
||||
rgb = pq_to_linear(rgb)
|
||||
rgb = torch.matmul(rgb, matrix.T)
|
||||
|
||||
@ -87,7 +88,7 @@ class ConvertColorSpace(IO.ComfyNode):
|
||||
|
||||
elif target_color_space == "HDR Display (PQ/Rec.2020)":
|
||||
# convert Gamut from Linear Rec.709 to Linear Rec.2020
|
||||
rgb = torch.matmul(rgb, M_709_to_2020.to(device).T).clamp(min=0)
|
||||
rgb = torch.matmul(rgb, M_709_to_2020.to(device=device, dtype=rgb.dtype).T).clamp(min=0)
|
||||
rgb = linear_to_pq(rgb)
|
||||
|
||||
img_tensor = torch.cat([rgb, alpha], dim=-1) if has_alpha else rgb
|
||||
|
||||
@ -943,7 +943,7 @@ class SaveImageAdvanced(IO.ComfyNode):
|
||||
def define_schema(cls):
|
||||
return IO.Schema(
|
||||
node_id="SaveImageAdvanced",
|
||||
search_aliases=["save", "save image", "export image", "output image", "write image", "download"],
|
||||
search_aliases=["save", "save image", "export image", "output image", "write image"],
|
||||
display_name="Save Image",
|
||||
description="Saves the input images to your ComfyUI output directory.",
|
||||
category="image",
|
||||
@ -989,7 +989,7 @@ class SaveImageAdvanced(IO.ComfyNode):
|
||||
),
|
||||
IO.Combo.Input(
|
||||
"interpret_as",
|
||||
options=["sRGB", "Linear", "Raw/Data"],
|
||||
options=["sRGB"],
|
||||
default="sRGB",
|
||||
advanced=True,
|
||||
),
|
||||
@ -1006,7 +1006,7 @@ class SaveImageAdvanced(IO.ComfyNode):
|
||||
),
|
||||
IO.Combo.Input(
|
||||
"interpret_as",
|
||||
options=["sRGB", "Linear", "Raw/Data"],
|
||||
options=["Linear", "Raw/Data"],
|
||||
default="Linear",
|
||||
advanced=True,
|
||||
),
|
||||
@ -1068,16 +1068,11 @@ class SaveImageAdvanced(IO.ComfyNode):
|
||||
stream.pix_fmt = av_fmt
|
||||
|
||||
elif file_format == "avif":
|
||||
try:
|
||||
stream = container.add_stream('libsvtav1', rate=1)
|
||||
except Exception:
|
||||
stream = container.add_stream('av1', rate=1)
|
||||
stream = container.add_stream('libsvtav1', rate=1)
|
||||
|
||||
stream.time_base = Fraction(1, 1)
|
||||
|
||||
if bit_depth == "12-bit":
|
||||
stream.pix_fmt = 'yuv420p12le'
|
||||
elif bit_depth in ["10-bit", "16-bit", "32-bit"]:
|
||||
if bit_depth in ["10-bit", "16-bit", "32-bit"]:
|
||||
stream.pix_fmt = 'yuv420p10le'
|
||||
else:
|
||||
stream.pix_fmt = 'yuv420p'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user