fix ImageScaleRestoreV2 node add total_pixel method
This commit is contained in:
@@ -80,7 +80,7 @@ When this error has occurred, please check the network environment.
|
||||
## Update
|
||||
<font size="4">**If the dependency package error after updating, please reinstall the relevant dependency packages. </font><br />
|
||||
|
||||
|
||||
* [ImageScaleRestoreV2](#ImageScaleRestoreV2) node add the ```total_pixel``` method to scale images.
|
||||
* Commit [MediapipeFacialSegment](#MediapipeFacialSegment) node,Used to segment facial features, including left and right eyebrows, eyes, lips, and teeth.
|
||||
* Commit [BatchSelector](#BatchSelector) node,Used to retrieve specified images or masks from batch images or masks.
|
||||
* LayerUtility creates new subdirectories such as SystemIO, Data, and Prompt. Some nodes are classified into subdirectories.
|
||||
@@ -594,7 +594,7 @@ The V2 upgraded version of ImageScaleRestore.
|
||||
Node options:
|
||||

|
||||
The following changes have been made based on ImageScaleRestore:
|
||||
* scale_by: Allow scaling by specified dimensions for longest, shortest, width, or height.
|
||||
* scale_by: Allow scaling by specified dimensions for long, short, width, height, or total pixels. When this option is set to by_scale, use the scale value, and for other options, use the scale_by_length value.
|
||||
* scale_by_length: The value here is used as ```scale_by``` to specify the length of the edge.
|
||||
|
||||
### <a id="table1">ImageMaskScaleAs</a>
|
||||
|
||||
+2
-1
@@ -80,6 +80,7 @@ git clone https://github.com/chflame163/ComfyUI_LayerStyle.git
|
||||
## 更新说明
|
||||
<font size="4">**如果本插件更新后出现依赖包错误,请重新安装相关依赖包。
|
||||
|
||||
* [ImageScaleRestoreV2](#ImageScaleRestoreV2)节点增加TotalPixel方法缩放图片。
|
||||
* 添加 [MediapipeFacialSegment](#MediapipeFacialSegment) 节点, 用于分割面部五官,包括左右眉、眼睛、嘴唇和牙齿。
|
||||
* 添加 [BatchSelector](#BatchSelector) 节点, 用于从批量图片或遮罩中获取指定的图片或遮罩。
|
||||
* LayerUtility大类新建子目录SystemIO, Data, Prompt。一部分节点被分类到子目录。
|
||||
@@ -587,7 +588,7 @@ ImageScaleRestore的V2升级版。
|
||||
节点选项说明:
|
||||

|
||||
在ImageScaleRestore基础上做了如下改变:
|
||||
* scale_by: 允许按长边、短边、宽度或高度指定尺寸缩放。
|
||||
* scale_by: 允许按长边、短边、宽度、高度或总像素指定尺寸缩放。此处选项设为by_scale时使用scale值,其他选项时使用scale_by_lengtt值。
|
||||
* scale_by_length: 这里的数值作为scale_by指定边的长度。
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import math
|
||||
|
||||
from .imagefunc import *
|
||||
|
||||
NODE_NAME = 'ImageScaleRestore V2'
|
||||
@@ -10,14 +12,14 @@ class ImageScaleRestoreV2:
|
||||
@classmethod
|
||||
def INPUT_TYPES(self):
|
||||
method_mode = ['lanczos', 'bicubic', 'hamming', 'bilinear', 'box', 'nearest']
|
||||
scale_by_list = ['by_scale', 'longest', 'shortest', 'width', 'height']
|
||||
scale_by_list = ['by_scale', 'longest', 'shortest', 'width', 'height', 'total_pixel(kilo pixel)']
|
||||
return {
|
||||
"required": {
|
||||
"image": ("IMAGE", ), #
|
||||
"scale": ("FLOAT", {"default": 1, "min": 0.01, "max": 100, "step": 0.01}),
|
||||
"method": (method_mode,),
|
||||
"scale_by": (scale_by_list,), # 是否按长边缩放
|
||||
"scale_by_length": ("INT", {"default": 1024, "min": 4, "max": 999999, "step": 1}),
|
||||
"scale_by_length": ("INT", {"default": 1024, "min": 4, "max": 99999999, "step": 1}),
|
||||
},
|
||||
"optional": {
|
||||
"mask": ("MASK",), #
|
||||
@@ -81,6 +83,12 @@ class ImageScaleRestoreV2:
|
||||
if scale_by == 'height':
|
||||
target_height = scale_by_length
|
||||
target_width = int(target_height * orig_width / orig_height)
|
||||
if scale_by == 'total_pixel(kilo pixel)':
|
||||
r = orig_width / orig_height
|
||||
target_width = math.sqrt(r * scale_by_length * 1000)
|
||||
target_height = target_width / r
|
||||
target_width = int(target_width)
|
||||
target_height = int(target_height)
|
||||
if target_width < 4:
|
||||
target_width = 4
|
||||
if target_height < 4:
|
||||
|
||||
Reference in New Issue
Block a user