-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a new function to create a mask from original and sketch images input as bytes. The function includes an option to create jagged edges in the mask. The output format of the mask image can be specified as well.
- Loading branch information
Showing
2 changed files
with
35 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# -*- coding: utf-8 -*- | ||
# @Time : 2024/2/13 下午12:42 | ||
# @Author : sudoskys | ||
# @File : __init__.py.py | ||
# @Software: PyCharm | ||
from novelai_python.utils.useful import create_mask_from_sketch | ||
|
||
with open('sk.jpg', 'rb') as f: | ||
sk_bytes = f.read() | ||
|
||
with open('ori.png', 'rb') as f: | ||
ori_bytes = f.read() | ||
|
||
return_bytes = create_mask_from_sketch(original_img_bytes=ori_bytes, sketch_img_bytes=sk_bytes, jagged_edges=True) | ||
|
||
with open('mask_export.png', 'wb') as f: | ||
f.write(return_bytes) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters