diff --git a/README.md b/README.md index 2d0ae0d..7f43c44 100644 --- a/README.md +++ b/README.md @@ -138,6 +138,11 @@ Nodes that have been migrated: [Migrated to Jovi_GLSL](https://github.com/Amorano/Jovi_GLSL) +**2025/05/27** @2.1.7: +* re-ranged all FLOAT to their maximum representations +* clerical cleanup for JS callbacks +* added `SPLIT` node to break images into vertical or horizontal slices + **2025/05/25** @2.1.6: * loosened restriction for python 3.11+ to allow for 3.10+ * * I make zero guarantee that will actually let 3.10 work and I will not support 3.10 diff --git a/core/trans.py b/core/trans.py index cb0a9d9..2e93fce 100644 --- a/core/trans.py +++ b/core/trans.py @@ -1,5 +1,6 @@ """ Jovimetrix - Transform """ +from re import I import sys from enum import Enum @@ -22,7 +23,7 @@ from cozy_comfyui.image.channel import \ channel_solid from cozy_comfyui.image.convert import \ - tensor_to_cv, cv_to_tensor_full, image_mask, image_mask_add + tensor_to_cv, cv_to_tensor_full, cv_to_tensor, image_mask, image_mask_add from cozy_comfyui.image.compose import \ EnumOrientation, EnumEdge, EnumMirrorMode, EnumScaleMode, EnumInterpolation, \ @@ -188,7 +189,7 @@ Split an image into two or four images based on the percentages for width and he "optional": { Lexicon.IMAGE: (COZY_TYPE_IMAGE, {}), Lexicon.VALUE: ("FLOAT", { - "default": 0.5, "min": 0, "max": 1 + "default": 0.5, "min": 0, "max": 1, "step": 0.001 }), Lexicon.FLIP: ("BOOLEAN", { "default": False, @@ -219,8 +220,25 @@ Split an image into two or four images based on the percentages for width and he images = [] pbar = ProgressBar(len(params)) for idx, (pA, percent, flip, mode, wihi, sample, matte) in enumerate(params): + w, h = wihi + pA = channel_solid(w, h, matte) if pA is None else tensor_to_cv(pA) - images.append(cv_to_tensor_full(pA, matte)) + if flip: + size = pA.shape[1] + percent = max(1, min(size-1, int(size * percent))) + image_a = pA[:, :percent] + image_b = pA[:, percent:] + else: + size = pA.shape[0] + percent = max(1, min(size-1, int(size * percent))) + image_a = pA[:percent, :] + image_b = pA[percent:, :] + + if mode != EnumScaleMode.MATTE: + image_a = image_scalefit(image_a, w, h, mode, sample) + image_b = image_scalefit(image_b, w, h, mode, sample) + + images.append([cv_to_tensor(img) for img in [image_a, image_b]]) pbar.update_absolute(idx) return image_stack(images) diff --git a/node_list.json b/node_list.json index 0b16307..943c742 100644 --- a/node_list.json +++ b/node_list.json @@ -37,6 +37,7 @@ "ROUTE (JOV) \ud83d\ude8c": "Routes the input data from the optional input ports to the output port, preserving the order of inputs", "SAVE OUTPUT (JOV) \ud83d\udcbe": "Save images with metadata to any specified path", "SHAPE GEN (JOV) \u2728": "Create n-sided polygons", + "SPLIT (JOV) \ud83c\udfad": "Split an image into two or four images based on the percentages for width and height", "STACK (JOV) \u2795": "Merge multiple input images into a single composite image by stacking them along a specified axis", "STRINGER (JOV) \ud83e\ude80": "Manipulate strings through filtering", "SWIZZLE (JOV) \ud83d\ude35": "Swap components between two vectors based on specified swizzle patterns and values", diff --git a/pyproject.toml b/pyproject.toml index 23dd1cf..85ff441 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "jovimetrix" description = "Animation via tick. Parameter manipulation with wave generator. Unary and Binary math support. Value convert int/float/bool, VectorN and Image, Mask types. Shape mask generator. Stack images, do channel ops, split, merge and randomize arrays and batches. Load images & video from anywhere. Dynamic bus routing. Save output anywhere! Flatten, crop, transform; check colorblindness or linear interpolate values." -version = "2.1.6" +version = "2.1.7" license = { file = "LICENSE" } readme = "README.md" authors = [{ name = "Alexander G. Morano", email = "amorano@gmail.com" }]