Every display name swaps ' (AusBoss)' for ' 🆎' - menus, docs, tooltips,
the README, and the example workflow's notes. Mapping keys never change,
so saved workflows keep loading; 'ausboss' keeps finding everything via
the category, the AUSBOSS_NODES_ prefix, and SEARCH_ALIASES. Python error
messages drop the suffix entirely so exception text stays ASCII for
cp1252 consoles.
The LM Studio endpoint toolbar declared no getMinHeight, so the frontend
gave its wrapper a 12px sliver and the buttons clipped; it now declares
32px through every sizing path, and the buttons breathe at 22px.
57 lines
1.6 KiB
Python
57 lines
1.6 KiB
Python
"""Image Size 🆎."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import torch
|
|
|
|
|
|
class AusBossImageSize:
|
|
CATEGORY = "🆎 AusBoss/Image"
|
|
DESCRIPTION = (
|
|
"Reads an image's dimensions as INTs: width, height, and the longest "
|
|
"and shortest edges. Wire them into resize, latent, or conditioning "
|
|
"nodes instead of retyping numbers that drift out of date."
|
|
)
|
|
SEARCH_ALIASES = [
|
|
"image size",
|
|
"width height",
|
|
"dimensions",
|
|
"resolution",
|
|
"longest edge",
|
|
"get size",
|
|
"ausboss",
|
|
]
|
|
|
|
@classmethod
|
|
def INPUT_TYPES(cls):
|
|
return {
|
|
"required": {
|
|
"image": (
|
|
"IMAGE",
|
|
{"tooltip": "BHWC image batch to measure."},
|
|
),
|
|
},
|
|
}
|
|
|
|
RETURN_TYPES = ("INT", "INT", "INT", "INT")
|
|
RETURN_NAMES = ("width", "height", "longest_edge", "shortest_edge")
|
|
OUTPUT_TOOLTIPS = (
|
|
"Width in pixels.",
|
|
"Height in pixels.",
|
|
"The larger of width and height.",
|
|
"The smaller of width and height.",
|
|
)
|
|
FUNCTION = "measure"
|
|
|
|
def measure(self, image):
|
|
if not isinstance(image, torch.Tensor) or image.ndim != 4:
|
|
raise ValueError("Image Size expected a BHWC IMAGE batch.")
|
|
height, width = int(image.shape[1]), int(image.shape[2])
|
|
return (width, height, max(width, height), min(width, height))
|
|
|
|
|
|
NODE_CLASS_MAPPINGS = {"AUSBOSS_NODES_ImageSize": AusBossImageSize}
|
|
NODE_DISPLAY_NAME_MAPPINGS = {"AUSBOSS_NODES_ImageSize": "Image Size 🆎"}
|
|
|
|
__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS"]
|