fix LoadPSD dependency package to load when in use
This commit is contained in:
@@ -41,6 +41,16 @@ git clone https://github.com/chflame163/ComfyUI_LayerStyle.git
|
||||
## Common Issues
|
||||
If the node cannot load properly or there are errors during use, please check the error message in the ComfyUI terminal window. The following are common errors and their solutions.
|
||||
|
||||
### ModuleNotFoundError: No module named 'psd_tools'
|
||||
This error is that the ```psd_tools``` were not installed correctly.
|
||||
|
||||
Solution:
|
||||
* Close ComfyUI and open the terminal window in the plugin directory and execute the following command:
|
||||
```../../../python_embeded/python.exe -s -m pip install psd_tools```
|
||||
If error occurs during the installation of psd_tool, such as ```ModuleNotFoundError: No module named 'docopt'``` , please download [docopt's whl](https://www.piwheels.org/project/docopt/) and manual install it.
|
||||
execute the following command in terminal window:
|
||||
```../../../python_embeded/python.exe -s -m pip install path/docopt-0.6.2-py2.py3-none-any.whl``` the ```path``` is path name of whl file.
|
||||
|
||||
### Cannot import name 'guidedFilter' from 'cv2.ximgproc'
|
||||
This error is caused by incorrect version of the ```opencv-contrib-python``` package,or this package is overwriteen by other opencv packages.
|
||||
|
||||
@@ -60,7 +70,7 @@ This error is caused by the low version of ```protobuf``` package.
|
||||
### ValueError: Trimap did not contain foreground values (xxxx...)
|
||||
This error is caused by the mask area being too large or too small when using the ```PyMatting``` method to handle the mask edges.
|
||||
|
||||
Solution:
|
||||
Solution:
|
||||
* Please adjust the parameters to change the effective area of the mask. Or use other methods to handle the edges.
|
||||
|
||||
### Requests.exceptions.ProxyError: HTTPSConnectionPool(xxxx...)
|
||||
@@ -71,7 +81,7 @@ When this error has occurred, please check the network environment.
|
||||
<font size="4">**If the dependency package error after updating, please reinstall the relevant dependency packages. </font><br />
|
||||
|
||||
* Commit [MaskByColor](#MaskByColor) node, Generate a mask based on the selected color.
|
||||
* Commit [LoadPSD](#LoadPSD) node, It read the psd format, and output layer images.
|
||||
* Commit [LoadPSD](#LoadPSD) node, It read the psd format, and output layer images. Note that this node requires the installation of the ```psd_tools``` dependency package, If error occurs during the installation of psd_tool, such as ```ModuleNotFoundError: No module named 'docopt'``` , please download [docopt's whl](https://www.piwheels.org/project/docopt/) and manual install it.
|
||||
* Commit [SegformerB2ClothesUltra](#SegformerB2ClothesUltra) node, it used to segment character clothing. The model segmentation code is from[StartHua](https://github.com/StartHua/Comfyui_segformer_b2_clothes), thanks to the original author.
|
||||
* [SaveImagePlus](#SaveImagePlus) node adds the output workflow to the json function, supports ```%date``` and ```%time``` to embeddint date or time to path and filename, and adds the preview switch.
|
||||
* Commit [SaveImagePlus](#SaveImagePlus) node,It can customize the directory where the picture is saved, add a timestamp to the file name, select the save format, set the image compression rate, set whether to save the workflow, and optionally add invisible watermarks to the picture.
|
||||
@@ -1158,6 +1168,8 @@ Node Options:
|
||||

|
||||

|
||||
Load the PSD format file and export the layers.
|
||||
Note that this node requires the installation of the ```psd_tools``` dependency package, If error occurs during the installation of psd_tool, such as ```ModuleNotFoundError: No module named 'docopt'``` , please download [docopt's whl](https://www.piwheels.org/project/docopt/) and manual install it.
|
||||
|
||||
|
||||
Node Options:
|
||||

|
||||
|
||||
+13
-2
@@ -1,6 +1,6 @@
|
||||
# ComfyUI Layer Style
|
||||
|
||||
如果您有定制节点、定制工作流业务,请联系email [chflame@163.com](mailto:chflame@163.com)
|
||||
商业合作请联系email [chflame@163.com](mailto:chflame@163.com)
|
||||
|
||||
|
||||
|
||||
@@ -34,6 +34,16 @@ git clone https://github.com/chflame163/ComfyUI_LayerStyle.git
|
||||
|
||||
## 常见问题
|
||||
如果节点不能正常加载,或者使用中出现错误,请在ComfyUI终端窗口查看报错信息。以下是常见的错误及解决方法。
|
||||
|
||||
### ModuleNotFoundError: No module named 'psd_tools'
|
||||
这个错误是```psd_tools```没有正确安装。
|
||||
|
||||
解决方法:
|
||||
* 关闭ComfyUI,在插件目录下打开终端窗口,执行以下命令:
|
||||
```../../../python_embeded/python.exe -s -m pip install psd_tools```
|
||||
如果安装psd_tool中出现```ModuleNotFoundError: No module named 'docopt'```错误,请下载[docopt的whl](https://www.piwheels.org/project/docopt/)手动安装。在终端执行以下命令:
|
||||
```../../../python_embeded/python.exe -s -m pip install path/docopt-0.6.2-py2.py3-none-any.whl``` path为whl文件的路径名。
|
||||
|
||||
### Cannot import name 'guidedFilter' from 'cv2.ximgproc'
|
||||
这个错误是```opencv-contrib-python```没有正确安装,或者安装后又安装了其他opencv包导致。
|
||||
|
||||
@@ -71,7 +81,7 @@ git clone https://github.com/chflame163/ComfyUI_LayerStyle.git
|
||||
<font size="4">**如果本插件更新后出现依赖包错误,请重新安装相关依赖包。
|
||||
|
||||
* 添加 [MaskByColor](#MaskByColor) 节点, 根据选择的颜色生成遮罩。
|
||||
* 添加 [LoadPSD](#LoadPSD) 节点, 读取psd格式并输出图层图片。
|
||||
* 添加 [LoadPSD](#LoadPSD) 节点, 读取psd格式并输出图层图片。注意这个节点需要安装psd_tools依赖包,如果安装psd_tool中出现```ModuleNotFoundError: No module named 'docopt'```错误,请下载[docopt的whl](https://www.piwheels.org/project/docopt/)手动安装。
|
||||
* 添加 [SegformerB2ClothesUltra](#SegformerB2ClothesUltra)节点,用于分割人物服装。模型分割代码来自[StartHua](https://github.com/StartHua/Comfyui_segformer_b2_clothes),感谢原作者。
|
||||
* [SaveImagePlus](#SaveImagePlus)节点增加输出工作流为json功能,支持使用```%date```和```%time```在路径和文件名嵌入时间,增加预览开关。
|
||||
* 添加 [SaveImagePlus](#SaveImagePlus)节点,可自定义保存图片的目录,文件名增加时间戳,选择保存格式,设置图片压缩率,设置是否保存工作流,以及可选给图片添加隐形水印。
|
||||
@@ -1144,6 +1154,7 @@ cropped_mask: 裁切后的遮罩。
|
||||

|
||||

|
||||
加载PSD格式文件,并导出图层。
|
||||
注意这个节点需要安装psd_tools依赖包,如果安装psd_tool中出现```ModuleNotFoundError: No module named 'docopt'```错误,请下载[docopt的whl](https://www.piwheels.org/project/docopt/)手动安装。
|
||||
|
||||
节点选项说明:
|
||||

|
||||
|
||||
+6
-2
@@ -5,8 +5,6 @@ import folder_paths
|
||||
import node_helpers
|
||||
from nodes import LoadImage
|
||||
from PIL import Image,ImageOps,ImageSequence,ImageDraw,ImageFont
|
||||
from psd_tools import PSDImage
|
||||
from psd_tools.api.layers import Layer
|
||||
from .imagefunc import pil2tensor, log, FONT_DICT, generate_text_image
|
||||
|
||||
|
||||
@@ -37,6 +35,9 @@ class LoadPSD(LoadImage):
|
||||
|
||||
def load_psd(self, image, file_path, include_hidden_layer, layer_index, find_layer_by, layer_name,):
|
||||
|
||||
from psd_tools import PSDImage
|
||||
from psd_tools.api.layers import Layer
|
||||
|
||||
NODE_NAME = 'LoadPSD'
|
||||
number_of_layers = 1
|
||||
layer_image = []
|
||||
@@ -47,7 +48,10 @@ class LoadPSD(LoadImage):
|
||||
psd_file_path = folder_paths.get_annotated_filepath(file_path)
|
||||
flat_image = Image.open(psd_file_path).convert("RGB")
|
||||
width, height = flat_image.size
|
||||
|
||||
if image.endswith(".psd"):
|
||||
from psd_tools import PSDImage
|
||||
from psd_tools.api.layers import Layer
|
||||
log(f"{NODE_NAME} -> Loading PSD file: {psd_file_path}")
|
||||
psd_image = PSDImage.open(psd_file_path)
|
||||
layers = []
|
||||
|
||||
@@ -147,9 +147,9 @@ class SaveImagePlus:
|
||||
workflow = (extra_pnginfo or {}).get('workflow')
|
||||
if workflow is None:
|
||||
log('No workflow found, skipping saving of JSON')
|
||||
with open(f'{json_file_name}.json', 'w') as workflow_file:
|
||||
with open(f'{json_file_name}', 'w') as workflow_file:
|
||||
json.dump(workflow, workflow_file)
|
||||
log(f'Saved workflow to {json_file_name}.json')
|
||||
log(f'Saved workflow to {json_file_name}')
|
||||
except Exception as e:
|
||||
log(
|
||||
f'Failed to save workflow as json due to: {e}, proceeding with the remainder of saving execution', message_type="warning")
|
||||
|
||||
Reference in New Issue
Block a user