-
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.
Merge pull request #39 from LlmKira/dev
✨ feat: add apply_lsb script, update enum with new model, and fix lsb…
- Loading branch information
Showing
8 changed files
with
96 additions
and
26 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 |
---|---|---|
|
@@ -175,3 +175,4 @@ cython_debug/ | |
/playground/newtag/ | ||
/playground/oldtag/ | ||
/playground/art_assert/ | ||
/playground/unpack/ |
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,21 @@ | ||
from pathlib import Path | ||
|
||
from novelai_python.tool.image_metadata import ImageMetadata, ImageLsbDataExtractor | ||
from PIL import Image | ||
|
||
image = Path(__file__).parent.joinpath("sample-0316.png") | ||
write_out = Path(__file__).parent.joinpath("sample-0316-out.png") | ||
try: | ||
meta = ImageMetadata.load_image(image) | ||
with Image.open(image) as img: | ||
new_io = meta.apply_to_image(img, inject_lsb=True) | ||
with open(write_out, 'wb') as f: | ||
f.write(new_io.getvalue()) | ||
new_meta = ImageMetadata.load_image(write_out) | ||
data = ImageLsbDataExtractor().extract_data(write_out) | ||
except ValueError: | ||
raise LookupError("Cant find a MetaData") | ||
print(data) | ||
print(new_meta) | ||
print(new_meta.used_model) | ||
print(ImageMetadata.verify_image_is_novelai(Image.open(write_out))) |
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[project] | ||
name = "novelai-python" | ||
version = "0.4.0" | ||
version = "0.4.1" | ||
description = "NovelAI Python Binding With Pydantic" | ||
authors = [ | ||
{ name = "sudoskys", email = "[email protected]" }, | ||
|
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
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