mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-26 00:47:24 +08:00
..
This commit is contained in:
parent
7069f6a92f
commit
6620c1898b
@ -1042,13 +1042,14 @@ class SaveImageAdvanced(IO.ComfyNode):
|
|||||||
# file pathing
|
# file pathing
|
||||||
filename_with_batch_num = filename.replace("%batch_num%", str(batch_number))
|
filename_with_batch_num = filename.replace("%batch_num%", str(batch_number))
|
||||||
|
|
||||||
file = f"{filename_with_batch_num}_{counter:05}.{file_format}"
|
file = f"{filename_with_batch_num}_{counter:05}_.{file_format}"
|
||||||
file_path = os.path.join(full_output_folder, file)
|
file_path = os.path.join(full_output_folder, file)
|
||||||
|
|
||||||
if file_format in ["png", "exr", "avif"]:
|
if file_format in ["png", "exr", "avif"]:
|
||||||
|
|
||||||
if bit_depth == "32-bit":
|
if bit_depth == "32-bit":
|
||||||
img_np = img_tensor.cpu().numpy().astype(np.float32)
|
img_np = img_tensor.cpu().numpy().astype(np.float32)
|
||||||
|
img_np = img_np[:, :, [1, 2, 0, 3]] if has_alpha else img_np[:, :,[1, 2, 0]]
|
||||||
av_fmt = 'gbrapf32le' if has_alpha else 'gbrpf32le'
|
av_fmt = 'gbrapf32le' if has_alpha else 'gbrpf32le'
|
||||||
elif bit_depth in ["10-bit", "12-bit", "16-bit"]:
|
elif bit_depth in ["10-bit", "12-bit", "16-bit"]:
|
||||||
img_np = (img_tensor * 65535.0).clamp(0, 65535).to(torch.int32).cpu().numpy().astype(np.uint16)
|
img_np = (img_tensor * 65535.0).clamp(0, 65535).to(torch.int32).cpu().numpy().astype(np.uint16)
|
||||||
@ -1112,11 +1113,6 @@ class SaveImageAdvanced(IO.ComfyNode):
|
|||||||
stream.height = height
|
stream.height = height
|
||||||
stream.time_base = Fraction(1, 1)
|
stream.time_base = Fraction(1, 1)
|
||||||
|
|
||||||
is_planar = av_fmt.startswith('gbrp') or 'p' in av_fmt.split('rgba')[-1]
|
|
||||||
if is_planar:
|
|
||||||
if av_fmt.startswith('gbr'):
|
|
||||||
img_np = img_np[:, :, [1, 2, 0, 3]] if has_alpha else img_np[:, :, [1, 2, 0]]
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
frame = av.VideoFrame.from_ndarray(img_np, format=av_fmt)
|
frame = av.VideoFrame.from_ndarray(img_np, format=av_fmt)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
@ -1138,7 +1134,7 @@ class SaveImageAdvanced(IO.ComfyNode):
|
|||||||
frame.time_base = stream.time_base
|
frame.time_base = stream.time_base
|
||||||
if file_format == "avif":
|
if file_format == "avif":
|
||||||
frame.color_range = 2
|
frame.color_range = 2
|
||||||
frame.colorspace = 1
|
frame.colorspace = stream.codec_context.colorspace
|
||||||
|
|
||||||
for packet in stream.encode(frame):
|
for packet in stream.encode(frame):
|
||||||
container.mux(packet)
|
container.mux(packet)
|
||||||
|
|||||||
3
nodes.py
3
nodes.py
@ -2464,7 +2464,8 @@ async def init_builtin_extra_nodes():
|
|||||||
"nodes_curve.py",
|
"nodes_curve.py",
|
||||||
"nodes_rtdetr.py",
|
"nodes_rtdetr.py",
|
||||||
"nodes_frame_interpolation.py",
|
"nodes_frame_interpolation.py",
|
||||||
"nodes_sam3.py"
|
"nodes_sam3.py",
|
||||||
|
"nodes_convert_color_space.py",
|
||||||
]
|
]
|
||||||
|
|
||||||
import_failed = []
|
import_failed = []
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user