Delete nodes.py

This commit is contained in:
Nitin Garg
2025-11-25 10:11:54 -05:00
committed by GitHub
parent d14d661b06
commit d759505fbe
-41
View File
@@ -1,41 +0,0 @@
import torch
class ImageMegapixels:
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"image": ("IMAGE",),
}
}
RETURN_TYPES = ("FLOAT",)
RETURN_NAMES = ("megapixels",)
FUNCTION = "calculate_megapixels"
CATEGORY = "utils"
def calculate_megapixels(self, image):
# Safety checks
if image is None or image.dim() != 4:
return (0.0,)
# Shape: [batch, height, width, channels]
_, height, width, _ = image.shape
# Calculate megapixels (using first image in batch)
megapixels = (height * width) / 1_000_000.0
# Always return a float, never a string!
return (float(megapixels),)
# ────────────────────────────────
# Node registration
# ────────────────────────────────
NODE_CLASS_MAPPINGS = {
"ImageMegapixels": ImageMegapixels
}
NODE_DISPLAY_NAME_MAPPINGS = {
"ImageMegapixels": "Calculate Image Megapixels"
}