Skip to content

pypi_0.5.2 Add ImageVerifier for tool.image_metadata

Latest
Compare
Choose a tag to compare
@sudoskys sudoskys released this 27 Sep 13:11
· 3 commits to main since this release
feeb058

What's Changed

  • (feat):Update Readme by @sudoskys in #77
  • (refactor): Add ImageVerifier for tool.image_metadata / add bch_utils by @sudoskys in #78

!! Breakchange

  • delete ImageMetadata.verify_image_is_novelai instead of ImageVerifier.verify

Usage

from pathlib import Path

from novelai_python.tool.image_metadata import ImageMetadata, ImageVerifier

image = Path(__file__).parent.joinpath("sample-0316.png")
image_clear = ImageMetadata.reset_alpha(
    image=image
)

try:
    meta = ImageMetadata.load_image(image)
except ValueError:
    raise LookupError("Cant find a MetaData")

print(meta.Title)
print(f"Description: {meta.Description}")
print(f"Comment: {meta.Comment}")
print(f"Request Method: {meta.Comment.request_type}")
print(f"Used image model: {meta.used_model}")
# Verify if the image is from NovelAI
is_novelai, have_latent = ImageVerifier().verify(image=image)
print(f"Is NovelAI: {is_novelai}")
print(f"Have Latent: {have_latent}")

Full Changelog: pypi_0.5.1...pypi_0.5.2