mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-10 14:20:49 +08:00
- ComfyUI can now load EXR files. - There are new arithmetic nodes for floats and integers. - EXR nodes can load depth maps and be remapped with ImageApplyColormap. This allows end users to use ground truth depth data from video game engines or 3D graphics tools and recolor it to the format expected by depth ControlNets: grayscale inverse depth maps and "inferno" colored inverse depth maps. - Fixed license notes. - Added an additional known ControlNet model. - Because CV2 is now used to read OpenEXR files, an environment variable must be set early on in the application, before CV2 is imported. This file, main_pre, is now imported early on in more places.
49 lines
1.1 KiB
Python
49 lines
1.1 KiB
Python
from torch import Tensor
|
|
|
|
from comfy.nodes.package_typing import CustomNode, InputTypes, ValidatedNodeResult
|
|
|
|
|
|
class ImageMin(CustomNode):
|
|
@classmethod
|
|
def INPUT_TYPES(cls) -> InputTypes:
|
|
return {
|
|
"required": {
|
|
"image": ("IMAGE", {})
|
|
}
|
|
}
|
|
|
|
RETURN_TYPES = ("FLOAT",)
|
|
CATEGORY = "image/postprocessing"
|
|
FUNCTION = "execute"
|
|
|
|
def execute(self, image: Tensor) -> ValidatedNodeResult:
|
|
return float(image.min().item()),
|
|
|
|
|
|
class ImageMax(CustomNode):
|
|
@classmethod
|
|
def INPUT_TYPES(cls) -> InputTypes:
|
|
return {
|
|
"required": {
|
|
"image": ("IMAGE", {})
|
|
}
|
|
}
|
|
|
|
RETURN_TYPES = ("FLOAT",)
|
|
CATEGORY = "image/postprocessing"
|
|
FUNCTION = "execute"
|
|
|
|
def execute(self, image: Tensor) -> ValidatedNodeResult:
|
|
return float(image.max().item()),
|
|
|
|
|
|
NODE_CLASS_MAPPINGS = {
|
|
ImageMin.__name__: ImageMin,
|
|
ImageMax.__name__: ImageMax,
|
|
}
|
|
|
|
NODE_DISPLAY_NAME_MAPPINGS = {
|
|
ImageMin.__name__: "Image Minimum Value",
|
|
ImageMax.__name__: "Image Maximum Value"
|
|
}
|