fix ImageScaleByAspectRatioV2 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.
|
||||
* [ImageScaleRestoreV2](#ImageScaleRestoreV2) and [ImageScaleByAspectRatioV2](#ImageScaleByAspectRatioV2) nodes 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.
|
||||
@@ -653,8 +653,8 @@ V2 Upgraded Version of ImageScaleByAspectRatio
|
||||
Node options:
|
||||

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

|
||||
在ImageScaleByAspectRatio基础上做了如下改变:
|
||||
* scale_by: 允许按长边、短边、宽度或高度指定尺寸缩放。
|
||||
* scale_by_length: 这里的数值作为scale_by指定边的长度。
|
||||
* scale_to_side: 允许按长边、短边、宽度、高度或总像素指定尺寸缩放。
|
||||
* scale_to_length: 这里的数值作为scale_to_side指定边的长度, 或者总像素数量(kilo pixels)。
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ class ImageScaleByAspectRatioV2:
|
||||
fit_mode = ['letterbox', 'crop', 'fill']
|
||||
method_mode = ['lanczos', 'bicubic', 'hamming', 'bilinear', 'box', 'nearest']
|
||||
multiple_list = ['8', '16', '32', '64', 'None']
|
||||
scale_to_list = ['None', 'longest', 'shortest', 'width', 'height']
|
||||
scale_to_list = ['None', 'longest', 'shortest', 'width', 'height', 'total_pixel(kilo pixel)']
|
||||
return {
|
||||
"required": {
|
||||
"aspect_ratio": (ratio_list,),
|
||||
@@ -96,6 +96,11 @@ class ImageScaleByAspectRatioV2:
|
||||
elif scale_to_side == 'height':
|
||||
target_height = scale_to_length
|
||||
target_width = int(target_height * ratio)
|
||||
elif scale_to_side == 'total_pixel(kilo pixel)':
|
||||
target_width = math.sqrt(ratio * scale_to_length * 1000)
|
||||
target_height = target_width / ratio
|
||||
target_width = int(target_width)
|
||||
target_height = int(target_height)
|
||||
else:
|
||||
target_width = orig_width
|
||||
target_height = int(target_width / ratio)
|
||||
@@ -112,6 +117,11 @@ class ImageScaleByAspectRatioV2:
|
||||
elif scale_to_side == 'height':
|
||||
target_height = scale_to_length
|
||||
target_width = int(target_height * ratio)
|
||||
elif scale_to_side == 'total_pixel(kilo pixel)':
|
||||
target_width = math.sqrt(ratio * scale_to_length * 1000)
|
||||
target_height = target_width / ratio
|
||||
target_width = int(target_width)
|
||||
target_height = int(target_height)
|
||||
else:
|
||||
target_height = orig_height
|
||||
target_width = int(target_height * ratio)
|
||||
|
||||
Reference in New Issue
Block a user